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.

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.