PDA

View Full Version : Creating inline SubReport using Pentaho Reporting API



pmeng
10-07-2010, 05:43 PM
Can someone show me some code snippet on how to create an inline SubReport using Pentaho reporting API?

No matter what I do, the subreport I created turned out to be "banded".

Taqua
10-09-2010, 06:00 AM
How about:


Subreport sr;
band.addElement(sr);

Make sure you also provide the correct styling for your subreport element according to the layout manager used in the band.

To compare: A banded subreport is created via:


SubReport sr;
rootLevelBand.addSubreport(sr);

pmeng
10-14-2010, 02:33 PM
What makes a root level band vs a not root level band?

Taqua
10-14-2010, 03:04 PM
Anything that implements "RootLevelBand" is a rootlevel band. Or speaking more from a end-user view: Any of the predefined structural bands like GroupHeader etc that you can see when opening a new report in PRD are root-level bands. They are called that way because they are the root-elements of each of the content areas that are printed when the report is processed.

Banded Subreports can be added to any band that actually extends "AbstractRootLevelBand", like Group- and Report Header and Footer, Itemband etc. The javaDoc lists all known implementations.