Merging Several Reports into One
Our sample projects and report templates can help you learn the basics of working with our products.Several rendered reports can be combined into one document by rendering each and adding its pages into a target report.
Render each report, collect its pages.
How it works. The merged report holds the rendered pages of all sources, so multiple templates present as one continuous document.
Render each report, collect its pages.
StiReport report1 = StiSerializeManager.deserializeReport(new File(path1));
report1.render();
StiReport report2 = StiSerializeManager.deserializeReport(new File(path2));
report2.render();
StiReport reportMerge = StiReport.newInstance();
reportMerge.getRenderedPages().clear();
for (StiPage page : report1.getRenderedPages()) reportMerge.getRenderedPages().add(page);
for (StiPage page : report2.getRenderedPages()) reportMerge.getRenderedPages().add(page);
reportMerge.setIsRendered(true);getRenderedPages().add(page)— append an already-rendered page into the target report.setIsRendered(true)— mark the merged report as built so the viewer shows it directly; renumber page-number texts afterwards.
How it works. The merged report holds the rendered pages of all sources, so multiple templates present as one continuous document.