Java Reference
In-Depth Information
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:
Built-In Variable
Contains the total number of pages in
the report.
Contains the current page number.
Contains the total number of columns in
the report.
Contains the current column number.
Contains the total number of records in
the report.
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
MyGroup_COUNT .
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"
<jasperReport name="TextFieldStretchDemo">
<field name="lots_of_data" class="java.lang.String"/>
<band height="30">
<textField isStretchWithOverflow="true">
<reportElement x="0" y="0" width="100" height="24"/>
Search WWH ::

Custom Search