ComponentOne FlexReport for WinForms
Resetting Page Counter
Working with FlexReport > Modifying the Fields > Resetting Page Counter

The C1FlexReport.Page variable is created and automatically updated by the control. It is useful for adding page numbers to page headers or footers. In some cases, you may want to reset the page counter when a group starts. For example, in a report that groups records by country. You can do this by adding code or using the Designer.

Using Code:

To reset the page counter when a group (for example, a new country) starts, set the PageFooter field's Text property. Enter the following code:

C1FlexReport1.Fields("PageFooter").Text = "[ShipCountry] & "" "" & [Page]"
c1FlexReport1.Fields["PageFooter"].Text = "[ShipCountry] + [Page]";

Using FlexReportDesigner:

To reset the page counter when a group (for example, a new country) starts, set the PageFooter field's Text property by completing the following steps:

  1. Select the PageFooter's page number field from the Properties window drop-down list in the Designer or select the field from the design pane. This reveals the field's available properties.
  2. Click the box next to the Text property, then click the drop-down arrow, and select Expression Editor from the list. VBScript Editor windows appears.
  3. In the VBScript Editor, type the following script:
    ="Page " & GroupPage(0) & " of " & GroupPages(0) & " for " & Country
  4. Click OK to close the editor.