I would like to force a break in textfield for very long text. I don't care if there is a space or not in the text. I just want the text to appear in the next line if it is too long for the textfield width.
I have tried this:
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement key="textField-2" positionType="Float" stretchType="RelativeToTallestObject" x="409" y="170" width="146" height="28">
<property name="net.sf.jasperreports.text.save.line.breaks" value="true"/>
</reportElement>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement>
<font fontName="Courier New" size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{customerReference}]]></textFieldExpression>
</textField>
But it is not working. I just cuts off the text after the first hyphen and the rest of the text is not displayed.
An example text is:
SIN684473 - 403904156/OO0D628902B SIN684473 - 403904156/OO0D628902B
Please help. Thanks.
EDIT 1: Thanks to Alex K, it is now working in PDF. But now in the Excel file, the field of customerReference is empty. But it is not empty in PDF.
Please help. Thanks.