A report can be built entirely in Java code — create the page, attach a data source, add bands, and place text components on them.

Create the report, page and data source.
StiReport report = new StiReport();

StiPage page = new StiPage(report);
report.getPages().add(page);

StiXmlDatabase xmlDatabase = new StiXmlDatabase("Demo", "Data/Demo.xsd", "Data/Demo.xml");
report.setDictionary(new StiDictionary(report));
report.getDictionary().getDatabases().add(xmlDatabase);

StiDataTableSource tableSource = new StiDataTableSource("Demo.Categories", "Categories", "Categories");
report.getDictionary().getDataSources().add(tableSource);
Add bands and components, then render.
StiDataBand dataBand = new StiDataBand();
dataBand.setDataSourceName("Categories");
dataBand.setHeight(0.5);
page.getComponents().add(dataBand);

StiText dataText = new StiText(new StiRectangle(0, 0, columnWidth, 0.5));
dataText.setText("{Categories.Name}");
dataBand.getComponents().add(dataText);

report.Render();

How it works. The object tree you build in code is the same one the designer produces, so a fully code-generated report renders identically.

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.