Reports for WPF | ComponentOne
Task Based Help / Customize Page Layout / Control Page break
In This Topic
    Control Page break
    In This Topic

    By default, C1.C1Report.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.C1.C1Report.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.C1.C1Report.Section.KeepTogether: Determines whether page breaks are allowed within sections. It has lower precedence than Group.C1.C1Report.Group.KeepTogether.
    • C1.C1Report.Section.ForcePageBreak: Allows you to specify that page breaks should be inserted before, after, or before and after the section.
    • Field.C1.C1Report.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.C1.C1Report.Section.KeepTogether.
    • C1.C1Report.Field.ForcePageBreak: Allows you to specify that page breaks should be inserted before, after, or before and after the field.

    You can set these properties through the Property grid in 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|tag=Creating a Basic Report Definition or open an existing report. Once you have the report in the C1ReportDesigner application, 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 C1.C1Report.Section.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

    See Also