问题
I have a reporting system where occasionally there will be multiple JasperReports in a row (e.g. a regular report, and an index report at the end). If the regular report is 21 pages long, then I need the subsequent report to start on page 22.
Is there a simple way to tell a JasperReport what page number to start on? I can do this in a roundabout way, but I feel like I am overlooking something simple. Google and Bing searches have not yielded any answers for me. Thanks for any help you can offer.
回答1:
No, there's no feature to say, "Start on page N."
But it doesn't seem that it would be too roundabout to just add a parameter $P{FirstPageNumber}. Then in the field where you would normally use the expression $V{PAGE_NUMBER}, you would instead use $V{PAGE_NUMBER} + $P{FirstPageNumber}.
回答2:
use "Page "+ $V{PAGE_NUMBER}.lowestOneBit( 1 )
来源:https://stackoverflow.com/questions/8714165/is-there-a-way-to-set-the-starting-page-number-in-jasperreports