【发布时间】:2017-02-06 09:12:31
【问题描述】:
我的应用程序中有几个类似的报表,因此我创建了一个基本结构,其中一个子报表位于标题中,另一个位于页脚中。
问题是我有 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>
我不知道为什么我找不到解决方法,如果有人可以帮助我...谢谢!
【问题讨论】: