如何在我的jasper报告中显示y的页面x

use*_*746 2 jasper-reports

我正在使用jasperreport-4.5.0生成报告.它正在生成报告.但是如果我的数据库中有大量数据,则报告vl显示在不同的页面中.所以我的要求是我的报告有12页然后我想要显示第1页,共12页,第2页,共12页,第3页,共12页......在我的页面标题区中显示这样的内容.我可以如何做到这一点,任何人都可以对此有所了解.

Raa*_*aam 9

您可以使用evaluationTime ="Report"属性来实现此目的.

考虑以下示例,我们首先打印"PAGE",然后使用默认的evalutaionTime属性打印页码.这将打印当前页码,然后我们打印OF,最后打印页码,评估时间设置为"报告",这将打印总页数.

        <band height="20">
        <elementGroup>
            <textField>
                <reportElement positionType="FixRelativeToBottom" x="709" y="0" width="53" height="20"/>
                <textElement verticalAlignment="Top">
                    <font size="12"/>
                </textElement>
                <textFieldExpression><![CDATA["PAGE"]]></textFieldExpression>
            </textField>

            <textField>
                <reportElement positionType="FixRelativeToBottom" x="762" y="0" width="23" height="20"/>
                <textElement>
                    <font size="12"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>

            <textField>
                <reportElement positionType="FixRelativeToBottom" x="785" y="0" width="29" height="20"/>
                <textElement>
                    <font size="12"/>
                </textElement>
                <textFieldExpression><![CDATA["OF"]]></textFieldExpression>
            </textField>

            <textField evaluationTime="Report">
                <reportElement positionType="FixRelativeToBottom" x="814" y="0" width="26" height="20"/>
                <textElement>
                    <font size="12"/>
                </textElement>
                <textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>

        </elementGroup>
    </band>
Run Code Online (Sandbox Code Playgroud)