async private void BlankPage_Loaded(object sender, RoutedEventArgs e) { byte[] buffer = Convert.FromBase64String(reportStr); stiReport1 = new StiReport(); await stiReport1.LoadAsync(buffer); await stiReport1.RenderAsync(); StiComponentsCollection comps = stiReport1.RenderedPages[0].GetComponents(); chart = comps["Chart1"] as StiChart; viewerCotnrol.Report = stiReport1; timer.Start(); }
public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // stiReport1.Render(); StiComponentsCollection comps = stiReport1.RenderedPages[0].GetComponents(); text = comps["Text1"] as StiText; chart = comps["Chart1"] as StiChart; }
public Form1() { // How to Activate //Stimulsoft.Base.StiLicense.Key = "6vJhGtLLLz2GNviWmUTrhSqnO..."; //Stimulsoft.Base.StiLicense.LoadFromFile("license.key"); //Stimulsoft.Base.StiLicense.LoadFromStream(stream); InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // stiPreviewControl1.PageViewMode = Stimulsoft.Report.Viewer.StiPageViewMode.Continuous; stiReport1.Render(); StiComponentsCollection comps = stiReport1.RenderedPages[0].GetComponents(); text = comps["Text1"] as StiText; chart = comps["Chart1"] as StiChart; }
public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // // How to Activate //Stimulsoft.Base.StiLicense.Key = "6vJhGtLLLz2GNviWmUTrhSqnO..."; //Stimulsoft.Base.StiLicense.LoadFromFile("license.key"); //Stimulsoft.Base.StiLicense.LoadFromStream(stream); stiReport1.Render(); StiComponentsCollection comps = stiReport1.RenderedPages[0].GetComponents(); text = comps["Text1"] as StiText; chart = comps["Chart1"] as StiChart; }
public StiReport Convert(string fileXtraReports) { CultureInfo currentCulture = Application.CurrentCulture; try { Application.CurrentCulture = new CultureInfo("en-US", false); report = new StiReport(); report.Pages.Clear(); XtraReport xtraReport = new XtraReport(); xtraReport.LoadLayout(fileXtraReports); detailLevel = 0; currentDataSourceName = xtraReport.DataMember; reportUnit = xtraReport.ReportUnit; if (reportUnit == ReportUnit.TenthsOfAMillimeter) { report.ReportUnit = StiReportUnitType.Millimeters; } else { report.ReportUnit = StiReportUnitType.HundredthsOfInch; } ReadPage(xtraReport, report); foreach (StiPage page in report.Pages) { StiComponentsCollection comps = page.GetComponents(); foreach (StiComponent comp in comps) { comp.Page = page; } page.LargeHeightFactor = 2; page.LargeHeight = true; } //create datasources and relations, variables foreach (DictionaryEntry de in fields) { string[] parts = ((string)de.Key).Split(new char[] { '.' }); if (parts.Length >= 2) { StiDataSource ds = report.Dictionary.DataSources[parts[0]]; if (ds == null) { ds = new StiDataTableSource(); ds.Name = parts[0]; ds.Alias = parts[0]; (ds as StiDataTableSource).NameInSource = datasetName; ds.Columns.Add(new StiDataColumn("id")); report.Dictionary.DataSources.Add(ds); } int pos = 1; while (pos < parts.Length - 1) { string dsName = parts[pos]; if (dsName.StartsWith(ds.Name)) { dsName = dsName.Substring(ds.Name.Length); } StiDataSource childSource = report.Dictionary.DataSources[dsName]; if (childSource == null) { childSource = new StiDataTableSource(); childSource.Name = dsName; childSource.Alias = dsName; (childSource as StiDataTableSource).NameInSource = datasetName; childSource.Columns.Add(new StiDataColumn("id")); report.Dictionary.DataSources.Add(childSource); } StiDataRelation relation = ds.GetChildRelations()[parts[pos]]; if (relation == null) { relation = new StiDataRelation(parts[pos], ds, childSource, new string[1] { "id" }, new string[1] { "id" }); report.Dictionary.Relations.Add(relation); } ds = childSource; pos++; } if (ds.Columns[parts[pos]] == null) { StiDataColumn column = new StiDataColumn(); column.Name = parts[pos]; ds.Columns.Add(column); } } else if (parts.Length == 1) { StiVariable varr = report.Dictionary.Variables[parts[0]]; if (varr == null) { varr = new StiVariable(); varr.Name = parts[0]; varr.Alias = parts[0]; report.Dictionary.Variables.Add(varr); } } } return(report); } finally { Application.CurrentCulture = currentCulture; } }
private void SortBands(StiPage input) { int counterPageHeader = 1000; int counterPageFooter = 2000; int counterHeader = 3000; int counterGroupHeader = 4000; int counterData = 5000; int counterDetail = 6000; int counterGroupFooter = 7000; int counterFooter = 8000; int counterOther = 10000; StiDataBand masterDataBand = null; Dictionary <int, StiComponent> dict = new Dictionary <int, StiComponent>(); List <int> keys = new List <int>(); foreach (StiComponent comp in input.Components) { int counter = 0; if (comp is StiPageHeaderBand) { counter = counterPageHeader++; } if (comp is StiPageFooterBand) { counter = counterPageFooter++; } if (comp is StiGroupHeaderBand) { counter = counterGroupHeader++; } else if (comp is StiGroupFooterBand) { counter = counterGroupFooter++; } else if (comp is StiHeaderBand) { counter = counterHeader++; } else if (comp is StiFooterBand) { counter = counterFooter++; } else if (comp is StiDataBand) { counter = counterData++; masterDataBand = comp as StiDataBand; } else if (comp is StiPage) { counter = counterDetail++; } else if (comp is StiChildBand) { counter = counterData++; } else { counter = counterOther++; } dict.Add(counter, comp); keys.Add(counter); } keys.Sort(); StiComponentsCollection comps = new StiComponentsCollection(input); foreach (int key in keys) { StiComponent comp = dict[key]; if (comp is StiPage) { StiPage cont = comp as StiPage; foreach (StiComponent comp2 in cont.Components) { StiDataBand band = comp2 as StiDataBand; if ((band != null) && (band.MasterComponent == null)) { band.MasterComponent = masterDataBand; } comps.Add(comp2); } } else { comps.Add(comp); } } input.Components = comps; }