JasperReport传递页码到子报告

时间:2013-12-08 05:32:24

标签: jasper-reports subreport page-numbering

我将页面编号信息从主报告传递到页脚子报表。在主报告中,我已声明子报告参数 pageTot pageNum 。它们通过向导映射到主报告中的参数 $ V {PAGE _ COUNT} $ V {PAGE _ NUMBER } 的。在子报表中,我已声明了两个参数 pageNum pageTot 。在他们的参数属性中,我取消选中了用作提示,并将它们设置为 java.lang.integer 类型。然后我替换了文本字段的文本字段表达式中的变量,以使用新参数名称​​ $ P {pageNum} $ P {pageTot} 。虽然 pageNum 参数的映射成功,但 pageTot 参数未显示正确的数字。对于27页的测试报告,第1-26页说总页数是38.最后一页,27,总变化为13.我还注意到原始公式都映射到 $ V { PAGE _ NUMBER} 。如何获得总数的正确页数?

1 个答案:

答案 0 :(得分:0)

这是我能找到的:

$V{PAGE_COUNT}
    - The number of records that display on the page.
$V{PAGE_NUMBER} 
    - The page number.  When evaluated at 'now', you get the current page.
    - When evaluated at 'report', you get the last page, or total.

我无法找到一种方法(iReport不支持)在“报告”时评估参数,因此我无法获得要显示的总页数。我最终将此功能从我的SubReport移到主报告中。

相关问题