Subreports using Java
As you learnt in Chapter 10, Subreports and Cross Tabs, subreports in Pentaho Reporting allow you to include fully featured reports inside a master report. In this section in particular, you will reach the same level of expertise from a Java perspective. In the following sections, you will go through the basics of Pentaho subreports, then you will move on to understand a fully working example of source code, available in the GitHub repository.
Subreports using Java
To understand the development of subreports using Java, let's describe the various components used for its definition. First is the SubReport
class, used to declare and manage subreport instances in MasterReport
. Differently from a regular element, a subreport is added to a report's band using the addSubReport(SubReport subReport)
method.
As you saw in Chapter 10, Subreports and Cross Tabs, subreports always use a different data source for the content definition. Using Java, all the declared queries in MasterReport...