NativeExcel2 for .Net Developer's Reference

IPageBreak.DeleteMethod

Deletes the specified page break.

[Visual Basic]
SubDelete()
[C#]
voidDelete();
[C++]
voidDelete();
[JScript]
functionDelete();

Example

This example deletes any horizontal page breaks which located at row less then 20.

[C#]
IPageBreaks pbs = book.Worksheets[1].HPageBreaks;
for (int i = pbs.Count; i > 0; i--) {
    if (pbs[i].Location.Row < 20) pbs[i].Delete();
}  
[VisualBasic]
Dim pbs As IPageBreaks = book.Worksheets(1).HPageBreaks
Dim i As Integer = pbs.Count
While i > 0
   If pbs(i).Location.Row  < 20
       pbs(i).Delete()
   End If
   i = i - 1
End While    
[C++]
IPageBreaks* pbs = book->Worksheets->Item[1]->HPageBreaks;
for (int i = pbs->Count; i > 0; i--) {
    if (pbs->Item[i]->Location->Row < 20) {
        pbs->Item[i]->Delete();
    }   
}  

See Also

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