Reputation: 113
I have a problem printing the content of a textfield. The report is an invoice and in the column footer I want to print some variable text depending of the invoice data.
I defined a textfield in Column Footer Band which gets his content from a parameter send via jasperstarter.
Problem:
The textfield cuts lines if they don't fit in the textfield even if I set "Stretch with overflow". If I make the textfield bigger, the text is displayed.
jrxml
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="StandardInvoice002" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="53084288-6a86-4b4d-a942-fa8965b8d117">
<queryString language="SQL">
<![CDATA[$P!{query}]]>
</queryString>
<columnFooter>
<band height="196" splitType="Stretch">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" isPrintRepeatedValues="false" x="30" y="165" width="500" height="21" isRemoveLineWhenBlank="true" uuid="27681503-6210-41cc-b444-5b9c0d720f4b"/>
<textElement markup="html"/>
<textFieldExpression><![CDATA["this is a very long text (1)<br>this is a very long text (2)<br>this is a very long text (3)<br>this is a very long text (4)"]]></textFieldExpression>
</textField>
</band>
</columnFooter>
</jasperReport>
Textfield contains 4 lines but only 2 are displayed
Upvotes: 2
Views: 1417
Reputation: 21710
The columnFooter
is of fixed size (as is the pageFooter
), hence it will not stretch, so you need to change your design.
Probably what your are looking for is a groupFooter
that shows on each page and is stacked at bottom.
Example
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="StandardInvoice002" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="53084288-6a86-4b4d-a942-fa8965b8d117">
<queryString language="SQL">
<![CDATA[]]>
</queryString>
<group name="pageGroup" footerPosition="StackAtBottom">
<groupExpression><![CDATA[$V{PAGE_NUMBER}]]></groupExpression>
<groupFooter>
<band height="142">
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" isPrintRepeatedValues="false" x="0" y="121" width="555" height="21" isRemoveLineWhenBlank="true" uuid="27681503-6210-41cc-b444-5b9c0d720f4b"/>
<textElement markup="html"/>
<textFieldExpression><![CDATA["this is a very long text (1)<br>this is a very long text (2)<br>this is a very long text (3)<br>this is a very long text (4)"]]></textFieldExpression>
</textField>
</band>
</groupFooter>
</group>
</jasperReport>
Output
Just adjust the groupExpression
to get the output on the page you like
Upvotes: 2