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:
- 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:
- Open the C1ReportDesigner application. For more information on how to access C1ReportDesigner, see Accessing C1ReportDesigner from Visual Studio.
- Create a new report or open an existing report. Once you have the report in C1ReportDesigner, you can modify the report properties.
- Click the Close Print Preview button to begin editing the report.
- In Design mode, select Detail from the drop-down list above the Properties window.
- Locate the OnPrint property and click the empty field next to it, and then click the ellipsis button.
- 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.