Creating Report at Runtime
Our sample projects and report templates can help you learn the basics of working with our products.A report can be built entirely in code under Avalonia — pages, bands and components are objects you create.
Building the report. Construct the report hierarchy in code, configure the required objects, add them to the template, and render the result.
Building the report. Construct the report hierarchy in code, configure the required objects, add them to the template, and render the result.
var report = new StiReport();
report.RegData(dataSet1);
report.Dictionary.Synchronize();
var page = report.Pages[0];
var headerBand = new StiHeaderBand();
var headerText = new StiText(new RectangleD(0, 0, 5, 0.5));
headerText.HorAlignment = StiTextHorAlignment.Center;
headerText.Brush = new StiSolidBrush(Color.LightGreen);
headerBand.Components.Add(headerText);
var dataBand = new StiDataBand();
dataBand.Components.Add(new StiText(new RectangleD(0, 0, 5, 0.5)));
page.Components.Add(headerBand);
page.Components.Add(dataBand);Every element you would place in the designer has a corresponding class, so a report can be generated dynamically. Data is loaded through Avalonia's AssetLoader and registered with RegData before rendering.