我在打印文本字段的内容时遇到了问题。报告是发票,在列页脚中,我希望根据发票数据打印一些可变文本。
我在列脚注Band中定义了一个textfield,它从通过jasperstarter发送的参数中获取他的内容。
问题:
如果textfield不适合textfield,即使我设置为“溢出的拉伸”,textfield也会剪行。如果我使文本字段变大,则会显示文本。
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包含4行,但仅显示2行。
发布于 2017-09-15 16:05:14
columnFooter的大小是固定的(和pageFooter一样),因此它不会拉伸,所以您需要更改您的设计。
可能你要找的是一个groupFooter,它显示在每一页上,并被堆放在底部。
示例
<?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>输出

只需调整groupExpression以获取您喜欢的页面上的输出即可
https://stackoverflow.com/questions/46171660
复制相似问题