I have a requirment where I need to display current page number and the total page number accross reports. I have a master report and 2 subreports. I am not able to identify how to display the correct pagenumber across the master and subreports. It would be great if u could help me. Thanks
问题:
回答1:
Open Ireport and Go to Window-> Palette option here you can see a Page number and total page element in tool category. Now just drag and drop into that location where you want to print page numbers.
回答2:
First of all you need to add a textfield to page footer in your main raport page, and the expression should be : $V{PAGE_NUMBER}+" /"
Then add other text field right next to the first one and the expression should be : " " + $V{PAGE_NUMBER}
This will look like this : 1 / 2
But the important one is that;
- set first text fields evaluation time: "now" from properties window.
- set second text fields evaluation time: "report" from properties window.
Then, for viewing correctly these page numbers on subreport pages; Click and select your main report name at top of Report Inspector window on the left side. Make sure you checked and selected this option from properties window :
Summary with Page Header and Footer
This will make your subreport show page numbers correctly. Make sure your subreport has summary band to get results.
There is no need to pass parameters to subreport or even no need to add these textfields to subreport pages to show page numbers.
Subreports will recognize page numbers automatically.