PageSetup class Worksheet

How a worksheet is laid out for printing: orientation, scaling, centering, what to print, and page margins.

Set it via Sheet.pageSetup; read it back from the same getter. Every field is optional; only the ones you set are written, so a value of null (or false) leaves Excel's default in place.

sheet.pageSetup = const PageSetup(
  orientation: PageOrientation.landscape,
  fitToWidth: 1,            // fit all columns on one page wide
  fitToHeight: 0,           // as many pages tall as needed
  printGridLines: true,
  margins: PageMargins.narrow(),
);

Print area, repeating print titles, and manual page breaks are set through the dedicated Sheet methods (Sheet.setPrintArea, Sheet.setPrintTitleRows, Sheet.insertRowPageBreak, ...) rather than here.

Constructors

PageSetup({PageOrientation? orientation, int? paperSize, int? scale, int? fitToWidth, int? fitToHeight, bool horizontalCentered = false, bool verticalCentered = false, bool printGridLines = false, bool printHeadings = false, PageMargins? margins})
Creates a page setup. All parameters are optional.
const

Properties

fitToHeight int?
Number of pages tall to fit the printout into, or null to not fit by height. 0 means "as many as needed".
final
fitToWidth int?
Number of pages wide to fit the printout into, or null to not fit by width. 0 means "as many as needed". Setting either fit value turns on fit-to-page (<pageSetUpPr fitToPage="1"/>).
final
hashCode int
The hash code for this object.
no setteroverride
horizontalCentered bool
Center the printout horizontally on the page.
final
margins PageMargins?
Page margins, or null to leave the file's margins untouched.
final
orientation PageOrientation?
Page orientation, or null for Excel's default (portrait).
final
paperSize int?
Paper size code (see PaperSize), or null for the printer default.
final
printGridLines bool
Print cell gridlines.
final
printHeadings bool
Print row and column headings (1, 2, 3... / A, B, C...).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scale int?
Print scale as a percentage (10-400), or null for 100%. Ignored by Excel when fitToWidth / fitToHeight are in effect.
final
verticalCentered bool
Center the printout vertically on the page.
final

Methods

copyWith({PageOrientation? orientation, int? paperSize, int? scale, int? fitToWidth, int? fitToHeight, bool? horizontalCentered, bool? verticalCentered, bool? printGridLines, bool? printHeadings, PageMargins? margins}) PageSetup
Returns a copy with the given fields replaced.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override