Class XlsxPageSetup
- Namespace
- DocToolkit
- Assembly
- DocToolkit.Xlsx.dll
A sheet's own print setup: orientation, the range that prints, and the rows that repeat at the top of every printed page.
public sealed class XlsxPageSetup
- Inheritance
-
XlsxPageSetup
- Inherited Members
Remarks
A workbook this package writes carries no page setup at all until this is applied — the
same class of gap the missing sectPr was for DOCX before 0.13.0. XlsxToPdfConverter
renders whatever the file happens to carry, which for a freshly created workbook is nothing, so
the render falls back to the reader's own default rather than reflecting anything the caller
asked for.
Deliberately a separate type from PageSetup rather than a shared one —
the two formats' print concepts do not line up. DOCX's PageSetup is a page SIZE
(dimensions and margins); a worksheet's print setup is a VIEW onto data that already exists
(which range prints, which rows repeat), and has no page-size concept of its own to hold. Forcing
one type to cover both would collide them, the same reason PdfMetadata stays
separate from DocumentMetadata.
Properties
Orientation
The print orientation.
public XlsxPageOrientation Orientation { get; }
Property Value
PrintArea
The range that prints, such as A1:D50. null prints the sheet's
whole used range, Excel's own default.
public string? PrintArea { get; }
Property Value
RepeatRowCount
How many rows, counted from row 1, repeat at the top of every printed page. null repeats none.
public int? RepeatRowCount { get; }
Property Value
- int?
Methods
Of(XlsxPageOrientation, string?, int?)
Describes a sheet's print setup.
public static XlsxPageSetup Of(XlsxPageOrientation orientation = XlsxPageOrientation.Portrait, string? printArea = null, int? repeatRowCount = null)
Parameters
orientationXlsxPageOrientationThe print orientation. Defaults to Portrait.
printAreastringThe range that prints, such as
A1:D50. null prints the whole used range.repeatRowCountint?How many rows, counted from row 1, repeat at the top of every printed page. null repeats none.
Returns
Exceptions
- ArgumentException
printAreais empty or whitespace, or names a sheet.- ArgumentOutOfRangeException
repeatRowCountis not positive.