Using Business Objects in the Report
Our sample projects and report templates can help you learn the basics of working with our products.This example shows how to use business objects in the report. First, load scripts:
Next, add report designer:
After that, create empty report object and load report template:
Then, create and register business object:
Next, create save method:
Finally, fill data to business objects:
In the screenshot below you can see the result of the sample code:

@using Stimulsoft.Base
@using Stimulsoft.Report
@using Stimulsoft.Report.Blazor
@using Stimulsoft.Report.Web
Next, add report designer:
<!--Report Designer-->
<StiBlazorDesigner Report="@Report" OnSaveReport="@OnSaveReport" />
After that, create empty report object and load report template:
@code
{
//Report object to use in designer
private StiReport Report;
protected override void OnInitialized()
{
base.OnInitialized();
//Create empty report object
this.Report = new StiReport();
//Load report template
this.Report.Load("Reports/BusinessObjects.mrt");
...
Then, create and register business object:
...
//Create business object
var list = GetBusinessObject();
//Register business object in the report template
this.Report.RegBusinessObject("MyList", list);
this.Report.Dictionary.Synchronize();
}
...
Next, create save method:
...
private void OnSaveReport(StiSaveReportEventArgs args)
{
var jsonReport = args.Report.SaveToJsonString();
}
...
Finally, fill data to business objects:
...
//Business objects
public class BusinessEntity
{
public string Name { get; set; }
public string Alias { get; set; }
public BusinessEntity(string name, string alias)
{
Name = name;
Alias = alias;
}
}
private System.Collections.ArrayList GetBusinessObject()
{
var list = new System.Collections.ArrayList();
list.Add(new BusinessEntity("name1", "alias1"));
list.Add(new BusinessEntity("name2", "alias2"));
list.Add(new BusinessEntity("name3", "alias3"));
return list;
}
}In the screenshot below you can see the result of the sample code:
