Click or drag to resize
HorizontalPageBreakCollection Class
Collection of horizontal page breaks (HorizontalPageBreak).
Inheritance Hierarchy
SystemObject
  GemBox.SpreadsheetPageBreakCollection
    GemBox.SpreadsheetPageBreakCollectionHorizontalPageBreak
      GemBox.SpreadsheetHorizontalPageBreakCollection

Namespace:  GemBox.Spreadsheet
Assembly:  GemBox.Spreadsheet (in GemBox.Spreadsheet.dll) Version: 41.3.30.1018
Syntax
public sealed class HorizontalPageBreakCollection : PageBreakCollection<HorizontalPageBreak>

The HorizontalPageBreakCollection type exposes the following members.

Properties
  NameDescription
Public propertyCount
Gets the number of page breaks contained in the collection.
(Inherited from PageBreakCollection.)
Public propertyItem
Gets or sets the horizontal page break at the specified index.
Top
Methods
  NameDescription
Public methodAdd(Int32)
Ads a new horizontal page break above the specified row.
Public methodAdd(Int32, Int32, Int32)
Ads a new horizontal page break above the specified row and within specified columns.
Public methodClear
Removes all page breaks.
(Inherited from PageBreakCollection.)
Public methodGetEnumerator
Returns an enumerator for the collection.
(Inherited from PageBreakCollectionT.)
Public methodRemoveAt
Removes the page break at the specified index.
(Inherited from PageBreakCollection.)
Top
Examples

Following code demonstrates how to add PageBreaks to ExcelWorksheet.

int columnsPerPage = 6, rowsPerPage = 30;

int usedColumnsCount = ws.CalculateMaxUsedColumns();
for (int i = columnsPerPage; i < usedColumnsCount; i += columnsPerPage)
    ws.VerticalPageBreaks.Add(i);

for (int i = rowsPerPage; i < ws.Rows.Count; i += rowsPerPage)
    ws.HorizontalPageBreaks.Add(i);
See Also