Back to Devexpress

How to: Insert Page Breaks in a Worksheet

officefileapi-401384-spreadsheet-document-api-examples-printing-how-to-insert-page-breaks-in-a-worksheet.md

latest1.9 KB
Original Source

How to: Insert Page Breaks in a Worksheet

  • Sep 19, 2023

A worksheet’s page breaks are stored in two PageBreaksCollection collections:

Use the PageBreaksCollection.Add method to insert page breaks.

csharp
// Insert a page break after the "F" column.
worksheet.VerticalPageBreaks.Add(6);
// Insert a page break below the 14th row.
worksheet.HorizontalPageBreaks.Add(14);
vb
' Insert a page break after the "F" column.
worksheet.VerticalPageBreaks.Add(6)
' Insert a page break below the 14th row.
worksheet.HorizontalPageBreaks.Add(14)

The image below shows the result (the workbook is opened in Microsoft® Excel®).

Delete a Page Break

Use the following API to remove page breaks from a worksheet: