Reports for WinForms | ComponentOne
In This Topic
    Controlling Page Breaks
    In This Topic

    By default, C1Report fills each page until the bottom, inserts a page break, and continues rendering in the next page. You can override this behavior using several properties:

    Set these properties through the Properties grid of the C1ReportDesigner.

    You can use script to change the properties while the report is being rendered. For example, to cause page breaks after each 10 Detail sections, complete the following steps:

    1. Open the C1ReportDesigner application. For more information on how to access C1ReportDesigner, see Accessing C1ReportDesigner from Visual Studio.
    2. Create a new report or open an existing report. Once you have the report in C1ReportDesigner, you can modify the report properties.
    3. Click the Close Print Preview button to begin editing the report.
    4. In Design mode, select Detail from the drop-down list above the Properties window.
    5. Locate the OnPrint property and click the empty field next to it, and then click the ellipsis button.
    6. The VBScript Editor appears. Enter the following VBScript expression in the code editor:
      cnt = cnt + 1
      detail.forcepagebreak = "none"
      if cnt >= 10 then
        cnt = 0
        detail.forcepagebreak = "after"
      endif
      
    Note: For the complete report, see report "07: Force Page Breaks" in the CommonTasks.xml report definition file, which is available in the ComponentOne Samples folder.