Compartir a través de


NamedRange.PageBreak Property

Definition

Gets or sets the location of a page break.

public:
 property int PageBreak { int get(); void set(int value); };
public int PageBreak { get; set; }
member this.PageBreak : int with get, set
Public Property PageBreak As Integer

Property Value

The location of a page break.

Examples

The following code example creates a NamedRange and then uses the PageBreak property to set a page break at the NamedRange.

This example is for a document-level customization.

Microsoft.Office.Tools.Excel.NamedRange pageBreakRange;
private void SetPageBreak()
{
    pageBreakRange = this.Controls.AddNamedRange(
         this.Range["C4"], "pageBreakRange");
    this.pageBreakRange.PageBreak =
        (int)Excel.XlPageBreak.xlPageBreakManual;
}
Private pageBreakRange As Microsoft.Office.Tools.Excel.NamedRange

Private Sub SetPageBreak()
    pageBreakRange = Me.Controls.AddNamedRange( _
        Me.Range("C4"), "pageBreakRange")
    Me.pageBreakRange.PageBreak = _
        Fix(Excel.XlPageBreak.xlPageBreakManual)
End Sub

Remarks

You can set this property using one of the following XlPageBreakvalues:

This property can return the location of either automatic or manual page breaks, but it can only set the location of manual breaks (it can only be set to xlPageBreakManual or xlPageBreakNone).

Applies to