Online Example: How to limit the number of records per page
This tutorial demonstrates how to limit the number of records displayed on a report's pages.
See Limit the Number of Records per Page to learn about the alternative approach to solving this task.
See Data Binding Modes to learn more about the available binding modes.
In this example, the number of data rows is passed to the report as a parameter.
Do the following to limit the number of records displayed on a report's pages:
To create a table report in this tutorial, start with a report that is bound to the "Products" table of the sample Northwind database (the nwind.mdb file included in the XtraReports installation). To learn more about binding a report to a data source, see Provide Data to Reports. In this tutorial, we will start with the following report layout.
Drop the XRPageBreak control from the DX.19.1: Report Controls Toolbox tab onto the report's Detail band, and place it at the top of the Detail table.
In the invoked Formatting Rules Editor, click the Edit Rule Sheet... button. The Formatting Rule Sheet Editor will appear.
In this dialog, click , to create a new formatting rule. Then set its FormattingRuleCollection.Visible property to true, and click the ellipsis button for the FormattingRule.Condition property to invoke the Condition Editor.
In the Condition Editor, define the following expression for the rule: ([DataSource.CurrentRowIndex] % ?parameter1 == 0) And ([DataSource.CurrentRowIndex] != 0).
Click OK, to save the changes and close the dialog. Then click Close to quit the Formatting Rule Sheet Editor.
Next, in the Formatting Rules Editor, you can see the newly created rule (called formattingRule1), which should be moved to the list of active rules on the right using the arrow buttons in the center of the dialog.
Click OK to close the editor.