如何在条件页面中显示文本取决于组值

时间:2013-05-13 12:12:46

标签: jasper-reports

我有一个 JasperReports jrxml,其中一个组的数据行跨越多个页面,比如说10页。

现在,我想要的是,在前9页的页脚中,应该有一个静态文本,如“下一页继续”,它不应该在第10页,即组的最后一页。

如何在 JasperReports 中执行此操作?

2 个答案:

答案 0 :(得分:0)

这是棘手的。 :)

你有一个文本字段的“打印表达式”属性。使用您的信息创建文本字段,并将“print when expression”设置为:

$V{test} == $V{PAGE_NUMBER}

其中$ V {test}是:

<variable name="test" class="java.lang.Integer" resetType="Page">
    <variableExpression><![CDATA[$V{PAGE_NUMBER}]]></variableExpression>
</variable>

并将该文本字段的评估时间设置为“自动”。应该这样做。

答案 1 :(得分:0)

这是我的主意。您可以将pageFooter用于第1至9页,并将lastPageFooter用于第10页

<pageFooter>
    <band height="20" splitType="Stretch">
        <staticText>
            <reportElement positionType="Float" x="0" y="0" width="500" height="20"/>
            <text><![CDATA[Continued on next page]]></text>
        </staticText>
    </band>
</pageFooter>
<lastPageFooter>
    <band height="20" splitType="Stretch">
        <staticText>
            <reportElement positionType="Float" x="0" y="0" width="500" height="20"/>
            <text><![CDATA[last page of group]]></text>
        </staticText>
    </band>
</lastPageFooter>