Reports are displayed in the order they were added to the report book, each report starting on a new page. The way pages are counted (the evaluation of the 'PageNumber' global object) may be different in the context of a report book compared to counting pages in a single report. The Report class has a property of type PageNumberingStyle that will let you control the behavior of page counting in the context of a report book.
The PageNumberingStyle property has meaning and effect only when the report is part of a report book.
The PageNumberingStyle enumeration has three values with self-explanatory names. "ResetNumbering" resets page numbering while page count aggregation continues, ResetNumberingAndCount resets both page numbering and page count and "Continue" indicates that both page numbering and page count aggregations continue from where the previous report in the book has left off. The default value of this property is "Continue". Below is a small example of how to use the PageNumberingStyle assuming that each of the three reports has a total of two pages:
The value of the TextBox in the PageHeader is equal to = "Page: " + PageNumber + " of " + PageCount
When working with the
PageNumberingStyle property, if the Reports have different values set for that property, the order of reports will matter for the values of the
For example, if there is a Report Book of two reports -
Report1.trdp that uses
Report2 that uses
PageNumberingStyle.Continue, and the order of the reports is the following:
- Report1.trdp - 5 total pages
- Report2.trdp - 1 total page
In such a case, when the total page count is being counted and the reporting engine goes to the second report, since it uses
PageNumberingStyle.Continue, the total
PageCount will be added to that of the
Report1.trdp report and if it has a total of 5 pages, and
Report2.trdp is one page, the
PageCount object will return
6 for both reports(only when rendered in the context of a Report Book).
On the other hand, if the order of the two reports is switched and now
Report2.trdp is first, since the next report(
PageNumberingStyle.ResetNumberingAndCount, when the counting gets to it the
PageCount will be restarted and it will now return the total page count of