Built-In Report Variables
JasperReports has a number of built-in report variables that we can use in our reports
without having to declare them. They are listed and described in the following table:
Contains the total number of pages in
Contains the current page number.
Contains the total number of columns in
Contains the current column number.
Contains the total number of records in
Contains the total number of records in the
group named "NameOfGroup". The exact
report variable name will match the group
name in the report. For example, for a group
named "MyGroup" the variable name will be
Stretching Text Fields to Accommodate
By default, <textField> elements have a fixed size. If the data they need to display
does not it into their defined size, it is simply not displayed in the report. This is
rarely the behavior we would want. Luckily, JasperReports allows us to alter this
default behavior. This is accomplished by setting the isStretchWithOverflow
attribute of the <textField> element to true .
The following JRXML template demonstrates how to allow text fields to stretch so
that they can accommodate large amounts of data:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN"
<field name="lots_of_data" class="java.lang.String"/>
<reportElement x="0" y="0" width="100" height="24"/>