ComponentOne Reports for WinForms Designer Edition: ComponentOne Reports for WinForms > Reports for WinForms Task-Based Help > Reporting Task-Based Help > Customizing the Page Layout > Controlling Page Breaks

Controlling Page Breaks

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:

      Group.KeepTogether: Determines whether Group Header sections are allowed to render on a page by themselves, if they must be rendered with at least one Detail section, or if the entire group should be kept together on a page.

      Section.KeepTogether: Determines whether page breaks are allowed within sections. It has lower precedence than Group.KeepTogether.

      ForcePageBreak: Allows you to specify that page breaks should be inserted before, after, or before and after the section.

      Field.KeepTogether: Determines whether page breaks are allowed within fields. This allows long Text fields to span multiple pages. It has lower precedence than Section.KeepTogether.

      ForcePageBreak: Allows you to specify that page breaks should be inserted before, after, or before and after the field.

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

* Sample Report Available

For the complete report, see report "07: Force Page Breaks" in the CommonTasks.xml report definition file, which is available for download from the CommonTasks sample on the ComponentOne HelpCentral Sample page.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.