Export (0) Print
Expand All
Expand Minimize

WorksheetBase.HPageBreaks Property

Gets an Microsoft.Office.Interop.Excel.HPageBreaks collection that represents the horizontal page breaks on the sheet.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

public HPageBreaks HPageBreaks { get; }

Property Value

Type: Microsoft.Office.Interop.Excel.HPageBreaks
An Microsoft.Office.Interop.Excel.HPageBreaks collection that represents the horizontal page breaks on the sheet.

There is a limit of 1026 horizontal page breaks per sheet.

The following code example uses the HPageBreaks property to add a horizontal page break at cell C5.

This example is for a document-level customization.

private void InsertPageBreaks()
{
    Excel.HPageBreak hbreak =
        this.HPageBreaks.Add(this.Range["C5"]);
    Excel.VPageBreak vbreak =
        this.VPageBreaks.Add(this.Range["C5"]);
}

Show:
© 2014 Microsoft