NativeExcel2 for .Net Developer's Reference

IPageBreaks Interface

A collection of page breaks within the print area. Each page break is represented by an IPageBreak interface.

For a list of all members of this type, see IPageBreaks Members.

[Visual Basic]
PublicInterfaceIPageBreaks
ImplementsIEnumerable
[C#]
publicinterfaceIPageBreaks:IEnumerable
[C++]
public__gc__interfaceIPageBreaks: publicIEnumerable
[JScript]
publicinterfaceIPageBreaksextendsIEnumerable

Remarks

Use HPageBreaks to return an IPageBreaks collection which contains horizontal page breaks.

Use VPageBreaks to return an IPageBreaks collection which contains vertical page breaks.

Example

This example adds horizontal page breaks after each ten rows.

[C#]
IPageBreaks pbs = book.Worksheets[1].HPageBreaks;
IRange usedrange = book.Worksheets[1].UsedRange;
pbs.Reset();
for (int i = 10; i <= usedrange.Rows.Count; i+=10) {
    pbs.Add(usedrange.Rows[i + 1]);
}  
[VisualBasic]
Dim pbs As IPageBreaks = book.Worksheets(1).HPageBreaks
Dim usedrange As IRange = book.Worksheets(1).UsedRange
Dim i As Integer = 10
pbs.Reset()
While i <= usedrange.Rows.Count
   pbs.Add(usedrange.Rows(i + 1))
   i = i + 10
End While    
[C++]
IPageBreaks* pbs = book->Worksheets->Item[1]->HPageBreaks;
IRange* usedrange = book->Worksheets->Item[1]->UsedRange;
pbs->Reset();
for (int i = 10; i <= usedrange->Rows->Count; i+=10) {
    pbs->Add(usedrange->Rows->Item[i + 1]);
}  

Requirements

Namespace: NativeExcel

Assembly: NativeExcel (in NativeExcel.dll)

See Also

IPageBreaks Members | NativeExcel Namespace | IWorksheet.HPageBreaks | IWorksheet.VPageBreaks | IPageBreak Interface | IWorksheet.UsedRange