By default,<textField>
elements have a fixed size. If the data they need to display does not fit 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" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="TextFieldStretchDemo">
<field name="lots_of_data" class="java.lang.String"/>
<detail>
<band height="30">
<textField isStretchWithOverflow...