public static StiReport GenerateReportFromDataTable(System.Data.DataTable dataTable, string reportHeader, StiPageOrientation orientation) { if ((dataTable == null) || (dataTable.Rows.get_Count() == 0)) { throw new System.ApplicationException("Не сформирован входящий набор данных."); } StiReport report = new StiReport(); report.RegData("data", (System.Data.DataTable) dataTable); report.Dictionary.Synchronize(); report.Dictionary.DataSources[0].Name = "data"; report.Dictionary.DataSources[0].Alias = "data"; StiReportTitleBand titleBand = new StiReportTitleBand { Height = 2.0, Name = "TitleBand" }; StiText component = new StiText(new RectangleD(0.0, 0.0, 30.0, 1.0), reportHeader) { DockStyle = StiDockStyle.Top, HorAlignment = StiTextHorAlignment.Center, Name = "TextHeader", Font = (System.Drawing.Font) new System.Drawing.Font("Arial", 12f, System.Drawing.FontStyle.Regular), Editable = true }; titleBand.Components.Add(component); StiDataBand dataBand = new StiDataBand { DataSourceName = "data", Height = 1.0, Name = "DataBand" }; double x = 0.0; double y = 0.0; double height = 1.0; System.Data.DataView view = new System.Data.DataView(dataTable); view.set_Sort("OrderColumn"); int num4 = 0; foreach (System.Data.DataRow row in view.ToTable("OutputTable").Rows) { if (System.Convert.ToBoolean(row.get_Item("PrintColumn"))) { double width = System.Convert.ToDouble(row.get_Item("WidthColumn")); component = CreateHeaderStiText("TextHeader" + ((int) num4), row.get_Item("HeaderColumn").ToString(), x, 1.0, width, 1.0); StiText dataText = CreateDataStiText("TextData" + ((int) num4), row.get_Item("DataColumn").ToString(), System.Convert.ToBoolean(row.get_Item("AlignColumn")), x, y, width, height); AddStitexts(component, dataText, ref titleBand, ref dataBand, ref x, width); } num4 = (int) (num4 + 1); } report.Pages[0].Components.Add(titleBand); report.Pages[0].Components.Add(dataBand); report.Pages[0].Orientation = orientation; report.Pages[0].Margins = new StiMargins(0.5, 0.5, 0.5, 0.5); return report; }