我想知道是否可以根据分组重置页码?
我的想法就像第1组有3页,将显示第1页,第3页,第2页,第3页和第3页第3页。第2组有1页,将显示第1页的第1页。
所以显示器将是:
Page 1 of 3
Page 2 of 3
Page 3 of 3
page 1 of 1
有可能吗?我搜索过的所有网络似乎都无法找到任何线索和步骤。
来源
<queryString language="SQL">
<![CDATA[Select * from Persons where ID = $P{ID}]]>
</queryString>
<field name="ID" class="java.lang.Object"/>
<group name="myGroup" isStartNewPage="true" isResetPageNumber="true">
<groupHeader>
<band height="224">
<subreport>
<reportElement x="300" y="135" width="270" height="60" uuid="1f20858d-c055-41e2-9a60-bbc040ae6485"/>
<subreportParameter name="ID_PERSON">
<subreportParameterExpression><![CDATA[$F{ID}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["subreport_1.jasper"]]></subreportExpression>
</subreport>
<staticText>
<reportElement x="280" y="10" width="100" height="30" uuid="dacdfcd9-150b-419d-ba3b-b56949cd518d"/>
<text><![CDATA[Group 1]]></text>
</staticText>
<break>
<reportElement x="0" y="210" width="99" height="1" uuid="a77bf8e0-98ea-4167-b852-f2cb5f6e1cf6"/>
</break>
<staticText>
<reportElement x="280" y="58" width="300" height="30" uuid="df9536c9-6584-43b3-b8b9-45fd0c0b95a6"/>
<text><![CDATA[This report is to testing the grouping.]]></text>
</staticText>
<break>
<reportElement x="0" y="111" width="100" height="1" uuid="6cda26ee-6e49-4e94-8d58-5d5dd42745e6"/>
</break>
</band>
</groupHeader>
<groupFooter>
<band height="50"/>
</groupFooter>
</group>
<group name="myGroup2" isStartNewPage="true" isResetPageNumber="true">
<groupHeader>
<band height="130">
<subreport>
<reportElement x="270" y="60" width="300" height="60" uuid="5663a0dc-9b14-485b-84a9-21b5e0c3b98d"/>
<subreportParameter name="ID_PERSON">
<subreportParameterExpression><![CDATA[$F{ID}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA["subreport_2.jasper"]]></subreportExpression>
</subreport>
<staticText>
<reportElement x="280" y="20" width="100" height="30" uuid="eaa5ee0f-c0e5-4555-b321-a4db52b4efde"/>
<text><![CDATA[Group 2]]></text>
</staticText>
</band>
</groupHeader>
<groupFooter>
<band height="58"/>
</groupFooter>
</group>
<pageFooter>
<band height="57" splitType="Stretch">
<textField evaluationTime="Group" evaluationGroup="myGroup">
<reportElement x="400" y="10" width="100" height="30" uuid="215676d9-e972-45bd-adad-b79c1fa27112"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="310" y="10" width="110" height="30" uuid="75a82ec2-a8ed-46dd-b5a1-147c450e32f8"/>
<textFieldExpression><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>