I want create a complex jrxml file to create PDF.
I want to put another jrxml in my jrxml file.
So.. my question is how to put one jrxml to another jrxml
My jrxml files are: salesreport.jrxml, financialreport.jrxml and report.jrxml
I want to put salesreport.jrxml and financialreport.jrxml to report.jrxml.
Usually you develop reports with iReport.
iReport has facilities for including subreports within reports (by dragging the subreport icon onto the master report page).
Note that JasperReports uses absolute paths for file references. I would recommend you set up parameters to your reports as follows:
$P{ROOT_DIR}
$P{SUBREPORT_DIR}
Give $P{SUBREPORT_DIR}
a default value of $P{ROOT_DIR} + "subreports/"
.
At that point, you can pass the absolute path as $P{ROOT_DIR}
into your report and then the subreports will be stored in a subdirectory called subreports
, which is located in $P{ROOT_DIR}
.
Or use the JasperCompileManager class from within the master jrxml file to dynamically compile it.
<subreportExpression><![CDATA[JasperCompileManager.compileReport($P{SUBREPORT_DIR}+"/myFile.jrxml")]]></subreportExpression>