我在我的应用程序中有几个类似的报告,因为这个原因,我创建了一个基本的结构,其中一个子报表内的标题和另一个内页面页脚。贾斯珀报告:子报表内的页码不起作用
问题是我有70个类似的报告,如果有一天我需要改变页脚结构,我不想改变70个报告,我更喜欢只改变一个。
在页脚报表,我有这样的:
<?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="reportFooterV" pageWidth="550" pageHeight="650" orientation="Landscape" whenNoDataType="AllSectionsNoDetail" columnWidth="550" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="6a63a92f-0859-4b0b-84b8-6166c2fe0951">
<property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="19"/>
<property name="ireport.y" value="0"/>
<parameter name="date" class="java.lang.String" isForPrompting="false"/>
<title>
<band height="19">
<textField>
<reportElement uuid="89a04d3d-73e0-4f28-9747-3206c4022769" x="0" y="0" width="191" height="19" forecolor="#999999"/>
<textElement verticalAlignment="Bottom">
<font fontName="Roboto" size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$P{date}]]></textFieldExpression>
</textField>
<textField evaluationTime="Auto">
<reportElement uuid="89a04d3d-73e0-4f28-9747-3206c4022769" x="352" y="0" width="99" height="19" forecolor="#999999"/>
<textElement textAlignment="Right" verticalAlignment="Bottom">
<font fontName="Roboto" size="10" isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</title>
</jasperReport>
但变量PAGE_NUMBER,不工作,始终在页面显示1。
在主报告中,我有这样的pageFooter区域
<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="systemParametersSummary" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" resourceBundle="properties.Messages" isIgnorePagination="true" uuid="6a63a92f-0859-4b0b-84b8-6166c2fe0951">
....
<pageFooter>
<band height="22">
<subreport>
<reportElement uuid="ac3cfc74-4e5a-45bc-945a-7ca6c82c4f6a" x="2" y="0" width="150" height="22"/>
<subreportParameter name="date">
<subreportParameterExpression><![CDATA[$P{date}]]></subreportParameterExpression>
</subreportParameter>
<subreportExpression><![CDATA[$P{footer}]]></subreportExpression>
</subreport>
</band>
</pageFooter>
</jasperReport>
我不知道为什么我不能找到办法解决这个,如果有人能帮助我...谢谢!
的可能的复制(http://stackoverflow.com/questions/9597256/how-to-add-page [如何跨主机和子报表添加页码] - 编号跨越主和子报表)&[如何在多页PDF报表中添加页码](http://stackoverflow.com/q/14641489/876298) –