如何在jasper报告中显示页码
how to show page number in jasper report
如何在jasper子报表中显示当前页码?我只为第一页做了这样的变量 $V{PAGE_NUMBER} and "("+$V{PAGE_COUNT}+")"
但我们如何在所有子报告中显示?
按照下面的模式,它应该有效。
<jasperReport>
<title>
</title>
<detail>
//Here goes all subreports
</detail>
<pageFooter>
<textField evaluationTime="Report">
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</pageFooter>
</jasperReport>
你必须为此使用页脚带,
当您必须显示总页数时,将 $V{PAGE_NUMBER}
的 print when 表达式设置为 "REPORT",并且
$V{PAGE_NUMBER}
's print when expression to "NOW" when you have to display current page number.
试试这个
<pageFooter>
<band height="22" splitType="Stretch">
<textField pattern="M/d/yy h:mm a">
<reportElement x="580" y="0" width="220" height="20" uuid="941d5c67-e986-4d5b-ba7e-2754f065e008"/>
<box padding="3"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="8"/>
</textElement>
<textFieldExpression><![CDATA["Printed on : "+new java.util.Date()]]></textFieldExpression>
</textField>
<textField>
<reportElement x="280" y="1" width="200" height="20" uuid="afe76ecf-00e9-4d52-a00b-44d38dc3aa65"/>
<box padding="3"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>
如何在jasper子报表中显示当前页码?我只为第一页做了这样的变量 $V{PAGE_NUMBER} and "("+$V{PAGE_COUNT}+")"
但我们如何在所有子报告中显示?
按照下面的模式,它应该有效。
<jasperReport>
<title>
</title>
<detail>
//Here goes all subreports
</detail>
<pageFooter>
<textField evaluationTime="Report">
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</pageFooter>
</jasperReport>
你必须为此使用页脚带,
当您必须显示总页数时,将 $V{PAGE_NUMBER}
的 print when 表达式设置为 "REPORT",并且
$V{PAGE_NUMBER}
's print when expression to "NOW" when you have to display current page number.
试试这个
<pageFooter>
<band height="22" splitType="Stretch">
<textField pattern="M/d/yy h:mm a">
<reportElement x="580" y="0" width="220" height="20" uuid="941d5c67-e986-4d5b-ba7e-2754f065e008"/>
<box padding="3"/>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font fontName="SansSerif" size="8"/>
</textElement>
<textFieldExpression><![CDATA["Printed on : "+new java.util.Date()]]></textFieldExpression>
</textField>
<textField>
<reportElement x="280" y="1" width="200" height="20" uuid="afe76ecf-00e9-4d52-a00b-44d38dc3aa65"/>
<box padding="3"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="SansSerif" size="8" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}]]></textFieldExpression>
</textField>
</band>
</pageFooter>