Back to Devexpress

XRPageBreak Class

xtrareports-devexpress-dot-xtrareports-dot-ui-f66f9f24.md

latest5.4 KB
Original Source

XRPageBreak Class

A Page Break control that defines a page delimiter in a report.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public class XRPageBreak :
    XRControl
vb
Public Class XRPageBreak
    Inherits XRControl

Remarks

Add the XRPageBreak control to a report to create a page break within the document at the control’s specified position. All report content below the page break is displayed on a new page.

At design time, the control is displayed as a dashed line attached to the report’s left margin, as shown in the following image.

Use the XRPageBreak control to insert a page break between controls within a report band (e.g., to divide subreports so that the second subreport starts on a new page).

When you publish a report that contains a page break within a control that does not contain text (any control other than XRLabel), the page break is only added to the control’s first occurrence in the document.

To insert a page break before or after a specific report band, use the Band.PageBreak property.

Example

The following method demonstrates how to position two labels located within one band on two separate pages, using an XRPageBreak object.

csharp
using System.Drawing;
using DevExpress.XtraReports.UI;
// ...
XtraReport report = new XtraReport();
DetailBand detailBand = new DetailBand();
report.Bands.Add(detailBand);
UsingXRPageBreak(detailBand);
// ...
public void UsingXRPageBreak(DetailBand Detail) {
   // Create two labels and an XRPageBreak object.
   XRLabel label1 = new XRLabel();
   XRLabel label2 = new XRLabel();
   XRPageBreak xrPageBreak0 = new XRPageBreak();

   // Add the controls to the Detail band.
   Detail.Controls.Add(label1);
   Detail.Controls.Add(label2);
   Detail.Controls.Add(xrPageBreak0);

   // Set the labels' text.
   label1.Text = "Label 1";
   label2.Text = "Label 2";

   // Set the location of the controls.

   // The first label is printed on the first page.
   label1.Location = new Point(100, 50);

   // Insert the page break.
   xrPageBreak0.Location = new Point(50, 150);

   // The second label is printed on the second page.
   label2.Location = new Point(100, 250);
}
vb
Imports System.Drawing
Imports DevExpress.XtraReports.UI
' ...
Dim report As New XtraReport()
Dim detailBand As New DetailBand()
report.Bands.Add(detailBand)
UsingXRPageBreak(detailBand)
' ...
Public Sub XRPageBreakUsing(ByVal Detail As DetailBand)
   ' Create two labels and an XRPageBreak object.
   Dim Label1 As New XRLabel()
   Dim Label2 As New XRLabel()
   Dim XrPageBreak0 As New XRPageBreak()

   ' Add the controls to the Detail band.
   Detail.Controls.Add(Label1)
   Detail.Controls.Add(Label2)
   Detail.Controls.Add(XrPageBreak0)

   ' Set the labels' text.
   Label1.Text = "Label 1"
   Label2.Text = "Label 2"

   ' Set the location of the controls.

   ' The first label is printed on the first page.
   Label1.Location = New Point(100, 50)

   ' Insert the page break.
   XrPageBreak0.Location = New Point(50, 150)

   ' The second label is printed on the second page.
   Label2.Location = New Point(100, 250)
End Sub

Implements

IScriptable

Inheritance

Object MarshalByRefObject Component XRControl XRPageBreak

See Also

XRPageBreak Members

Add Controls to a Report

DevExpress.XtraReports.UI Namespace