<parametersMapExpression> : This is used to pass a map containing report
parameters to the subreport. The map is usually obtained from a parameter
in the master report, or by using the built-in REPORTS_PARAMETERS_MAP
parameter to pass the parent report's parameters to the subreport.
<returnValue> : This is used to assign the value of one of the subreport's
variables to one of the master report's variables. The subreportVariable
attribute is used to indicate the subreport variable to use, and the
toVariable attribute is used to indicate the master report variable to use.
One last note about subreports is that subreports can have other subreports, which in
turn can have more subreports. There is no limit to the subreport nesting level.
In this chapter, we discussed several of JasperReports features that allow us to
control the layout of a report.
By setting the appropriate attributes of the <jasperReport> JRXML element, we can
control report-wide layout properties like margins, page width, page orientation,
and others. Text properties like size and font can be set by using report styles or by
setting the appropriate attributes of the <text> JRXML element. We can use styled
text to modify the style of individual words, phrases, or sentences by setting the
isStyledText attribute of the <textElement> JRXML element.
We learned to add multiple columns to a report by setting the columnCount attribute
of the <jasperReport> JRXML element as well as to divide report data into logical
groups by using the <group> JRXML element. The chapter also dealt with displaying
dynamic data in a report by using report expressions, using report variables to
encapsulate report expressions, and performing automated report calculations.
The chapter discussed how to allow text fields to stretch to accommodate
large amounts of data by setting the isStretchWithOverflow attribute of the
<textField> JRXML element to true . We went about setting the appropriate
attributes of the <reportElement> JRXML element, to control the layout of
individual report elements, including their size, width, height, and how they react
to having another element stretch beyond its declared size. We also learned to set
properties that affect a group of elements by grouping them in a frame via the
<frame> JRXML element as well as to set the isPrintRepeatedValues attributes of
the <reportElement> JRXML element to false to avoid printing repeated values
between datasource records. Lastly, we created subreports by taking advantage of
the <subReport> JRXML element.