A whole report — pages, bands and components — can be assembled in code, without a pre-designed .mrt template.

Register the data. Load a data source and synchronize the dictionary so fields become available to the report:
var report = new StiReport();

var dataSet = StiJsonToDataSetConverterV2.GetDataSetFromFile(@"Data\Demo.json");
report.RegData(dataSet);
report.Dictionary.Synchronize();
Build the page structure. Add bands to the page and text components to the bands. Expressions in braces are evaluated per row:
var page = report.Pages[0];

var headerBand = new StiHeaderBand { Height = 0.5, Name = "HeaderBand" };
page.Components.Add(headerBand);
headerBand.Components.Add(new StiText(new RectangleD(0, 0, 5, 0.5)) { Text = "CompanyName" });

var dataBand = new StiDataBand { DataSourceName = "Customers", Height = 0.5, Name = "DataBand" };
page.Components.Add(dataBand);
dataBand.Components.Add(new StiText(new RectangleD(0, 0, 5, 0.5)) { Text = "{Line}.{Customers.CompanyName}" });
Show the result.
report.Show();

How it works. The band tree you build in code is exactly what the designer would produce, so the report renders, prints and exports the same as a template-based one.

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.