Page Break After N Records (Section Reports)
In a Section report, you can add page breaks for each section at any point. Set it using the NewPage property of the section. If you set the NewPage property of a section to After, ActiveReports creates a new page after displaying the section. The following example code causes the report to break to a new page in the Detail section after every 10 records.
//C#
private int RowNumber; // Counts records to output
private void detail_Format(object sender, EventArgs e)
{
RowNumber++;
if (RowNumber < 10)
{
// No new page if the record count is less than 10.
this.detail.NewPage = NewPage.None;
}
else
{
// Make new page and update record count.
this.detail.NewPage = NewPage.After;
RowNumber = 0;
}
}
'Visual Basic
Private RowNumber As Integer ' Counts records to output
Private Sub Detail_Format(...) Handles Detail.Format
RowNumber = RowNumber + 1
If RowNumber < 10 Then
' No new page if the record count is less than 10.
Me.Detail.NewPage = NewPage.None
Else
' Make new page and update record count.
Me.Detail.NewPage = NewPage.After
RowNumber = 0
End If
End Sub
Important: You must change the NewPage property within the Format event of the section. There are other properties related to page breaks that might also be helpful. For more information on these properties, see the following topics in our User Guide.