Expand Minimize
This topic has not yet been rated - Rate this topic

NamedRange.PageBreak Property

Gets or sets the location of a page break.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
int PageBreak { get; set; }

Property Value

Type: Int32
The location of a page break.

You can set this property using one of the following XlPageBreak values:

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).

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;
}
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.