[]
A PageSettings object stores the page layout information used for printing or page-based export, including paper size, margins, header and footer content, page centering, gridline printing, draft mode, black-and-white printing, and print error display options.
Margin and paper size values are expressed in points.
PageSettings pageSettings = new PageSettings();
pageSettings.setTopMargin(36d);
pageSettings.setBottomMargin(36d);
pageSettings.setCenterHeader("Sales Report");
pageSettings.setCenterHorizontally(true);
final booleanfinal booleanfinal doublefinal Stringfinal IGraphicfinal Stringfinal IGraphicfinal booleanfinal booleanfinal booleangetDraft()final doublefinal doublefinal Stringfinal IGraphicfinal Stringfinal IGraphicfinal doublefinal doublefinal doublefinal PrintErrorsfinal booleanfinal Stringfinal IGraphicfinal Stringfinal IGraphicfinal doublefinal booleanfinal doublefinal voidsetAlignMarginsHeaderFooter(boolean value) final voidsetBlackAndWhite(boolean value) final voidsetBottomMargin(double value) final voidsetCenterFooter(String value) final voidsetCenterFooterPicture(IGraphic value) final voidsetCenterHeader(String value) final voidsetCenterHeaderPicture(IGraphic value) IGraphic object that represents the picture for the center section of the header.final voidsetCenterHorizontally(boolean value) final voidsetCenterVertically(boolean value) final voidsetDraft(boolean value) final voidsetFooterMargin(double value) final voidsetHeaderMargin(double value) final voidsetLeftFooter(String value) final voidsetLeftFooterPicture(IGraphic value) final voidsetLeftHeader(String value) final voidsetLeftHeaderPicture(IGraphic value) final voidsetLeftMargin(double value) final voidsetPaperHeight(double value) final voidsetPaperWidth(double value) final voidsetPrintErrors(PrintErrors value) final voidsetPrintGridlines(boolean value) final voidsetRightFooter(String value) final voidsetRightFooterPicture(IGraphic value) final voidsetRightHeader(String value) final voidsetRightHeaderPicture(IGraphic value) IGraphic object that represents the picture for the right section of the header.final voidsetRightMargin(double value) final voidsetScaleWithDocHeaderFooter(boolean value) final voidsetTopMargin(double value) Use this method to retrieve the header string configured by setLeftHeader(String) for the left section of the page header.
PageSettings pageSettings = new PageSettings();
pageSettings.setLeftHeader("Confidential");
String leftHeader = pageSettings.getLeftHeader();
PageSettings pageSettings = new PageSettings();
pageSettings.setLeftHeader("Confidential");
value - The text on the left header of the page.Use this method to retrieve the header content previously set by setCenterHeader(String) for the center header area.
PageSettings pageSettings = new PageSettings();
pageSettings.setCenterHeader("Sales Report");
String centerHeader = pageSettings.getCenterHeader();
null if no center header text has been set.
PageSettings pageSettings = new PageSettings();
pageSettings.setCenterHeader("Sales Report");
value - The center header text. Sets null if no center header text has been set.Use this method to retrieve the header string configured by setRightHeader(String) for the right section of the page header.
PageSettings pageSettings = new PageSettings();
pageSettings.setRightHeader("Quarterly Summary");
String rightHeader = pageSettings.getRightHeader();
null if no right header text has been set.
PageSettings pageSettings = new PageSettings();
pageSettings.setRightHeader("Quarterly Summary");
value - The text on the right header of the page, or null if no right header text has been set.
PageSettings pageSettings = new PageSettings();
worksheet.getPageSetup().setLeftHeader("&G");
IGraphic picture = worksheet.getPageSetup().getLeftHeaderPicture();
pageSettings.setLeftHeader("&G");
pageSettings.setLeftHeaderPicture(picture);
IGraphic leftHeaderPicture = pageSettings.getLeftHeaderPicture();
Use this method to assign an IGraphic object for the left header picture. The assigned graphic can then be configured with properties such as the image source and size.
PageSettings pageSettings = new PageSettings();
worksheet.getPageSetup().setLeftHeader("&G");
IGraphic graphic = worksheet.getPageSetup().getLeftHeaderPicture();
pageSettings.setLeftHeader("&G");
pageSettings.setLeftHeaderPicture(graphic);
value - The IGraphic object that represents the picture for the left section of the header; can be null.
PageSettings pageSettings = new PageSettings();
worksheet.getPageSetup().setCenterHeader("&G");
IGraphic picture = worksheet.getPageSetup().getCenterHeaderPicture();
pageSettings.setCenterHeader("&G");
pageSettings.setCenterHeaderPicture(picture);
IGraphic centerHeaderPicture = pageSettings.getCenterHeaderPicture();
IGraphic object that represents the picture for the center section of the header.Use this method to assign a picture object for the center header section after enabling the header picture field, for example by using setCenterHeader(String) with the &G code. The assigned picture object is used to set attributes about the picture.
PageSettings pageSettings = new PageSettings();
worksheet.getPageSetup().setCenterHeader("&G");
IGraphic graphic = worksheet.getPageSetup().getCenterHeaderPicture();
pageSettings.setCenterHeader("&G");
pageSettings.setCenterHeaderPicture(graphic);
value - The picture object for the center section of the header. Can be null.
PageSettings pageSettings = new PageSettings();
worksheet.getPageSetup().setRightHeader("&G");
IGraphic picture = worksheet.getPageSetup().getRightHeaderPicture();
pageSettings.setRightHeader("&G");
pageSettings.setRightHeaderPicture(picture);
IGraphic rightHeaderPicture = pageSettings.getRightHeaderPicture();
IGraphic object that represents the picture for the right section of the header.Use setRightHeader(String) with the "&G" placeholder to display the picture in the right header section.
PageSettings pageSettings = new PageSettings();
worksheet.getPageSetup().setRightHeader("&G");
IGraphic graphic = worksheet.getPageSetup().getRightHeaderPicture();
pageSettings.setRightHeader("&G");
pageSettings.setRightHeaderPicture(graphic);
value - The IGraphic object that represents the picture for the right section of the header. null is allowed.Use this property to determine whether page content is configured for black-and-white printing.
PageSettings pageSettings = new PageSettings();
pageSettings.setBlackAndWhite(true);
boolean blackAndWhite = pageSettings.getBlackAndWhite();
true if the elements of the document will be printed in black and white; otherwise, false.Use this property to set whether page content is configured for black-and-white printing.
PageSettings pageSettings = new PageSettings();
pageSettings.setBlackAndWhite(true);
value - true if the elements of the document will be printed in black and white; otherwise, false.When this property is true, the sheet is printed without graphics.
PageSettings pageSettings = new PageSettings();
pageSettings.setDraft(true);
boolean draft = pageSettings.getDraft();
true if the sheet will be printed without graphics; otherwise, false.When this property is true, the sheet is printed without graphics.
PageSettings pageSettings = new PageSettings();
pageSettings.setDraft(true);
value - true if the sheet will be printed without graphics; otherwise, false.This setting applies only to worksheets.
PageSettings pageSettings = new PageSettings();
pageSettings.setPrintGridlines(true);
boolean printGridlines = pageSettings.getPrintGridlines();
true if cell gridlines are printed on the page; otherwise, false.This setting applies only to worksheets.
PageSettings pageSettings = new PageSettings();
pageSettings.setPrintGridlines(true);
value - true if cell gridlines are printed on the page; otherwise, false.This setting specifies how worksheet error values are displayed when the worksheet is printed. It can be used together with setPrintErrors(PrintErrors) to suppress the display of error values in printed output.
PageSettings pageSettings = new PageSettings();
pageSettings.setPrintErrors(PrintErrors.Dash);
PrintErrors printErrors = pageSettings.getPrintErrors();
PrintErrors value that specifies how print errors are displayed.This setting controls how worksheet error values are displayed when the worksheet is printed. Use this method to show errors as-is or suppress them in printed output by using a different PrintErrors value.
PageSettings pageSettings = new PageSettings();
pageSettings.setPrintErrors(PrintErrors.Displayed);
value - The PrintErrors value that specifies how print errors are displayed. null is permitted.Use this property to determine whether the printed sheet content is centered between the left and right page margins.
PageSettings pageSettings = new PageSettings();
pageSettings.setCenterHorizontally(true);
boolean centerHorizontally = pageSettings.getCenterHorizontally();
true if the sheet is centered horizontally on the page when printed; otherwise, false.Use this property to set whether the printed sheet content is centered between the left and right page margins.
PageSettings pageSettings = new PageSettings();
pageSettings.setCenterHorizontally(true);
value - true if the sheet is centered horizontally on the page when printed; otherwise, false.
PageSettings pageSettings = new PageSettings();
pageSettings.setCenterVertically(true);
boolean centerVertically = pageSettings.getCenterVertically();
true if the sheet is centered vertically on the page when printed; otherwise, false.
PageSettings pageSettings = new PageSettings();
pageSettings.setCenterVertically(true);
value - true if the sheet is centered vertically on the page when printed; otherwise, false.Use this property to retrieve the current left page margin configured in the page settings.
PageSettings pageSettings = new PageSettings();
pageSettings.setLeftMargin(72);
double leftMargin = pageSettings.getLeftMargin();
Use this property to update the current left page margin configured in the page settings.
PageSettings pageSettings = new PageSettings();
pageSettings.setLeftMargin(72);
value - The size of the left margin, in points.
PageSettings pageSettings = new PageSettings();
pageSettings.setTopMargin(72d);
double topMargin = pageSettings.getTopMargin();
PageSettings pageSettings = new PageSettings();
pageSettings.setTopMargin(72d);
value - The size of the top margin, in points.This value is used for page layout when the worksheet is printed.
PageSettings pageSettings = new PageSettings();
pageSettings.setRightMargin(72);
double rightMargin = pageSettings.getRightMargin();
This value is used for page layout when the worksheet is printed.
PageSettings pageSettings = new PageSettings();
pageSettings.setRightMargin(72);
value - The size of the right margin, in points.This value specifies the bottom page margin used for printing or page-based export.
PageSettings pageSettings = new PageSettings();
pageSettings.setBottomMargin(36d);
double bottomMargin = pageSettings.getBottomMargin();
This value specifies the bottom page margin used for printing or page-based export.
PageSettings pageSettings = new PageSettings();
pageSettings.setBottomMargin(36d);
value - The size of the bottom margin, in points.Use this property to read the current spacing reserved for the header area in these page settings.
PageSettings pageSettings = new PageSettings();
pageSettings.setHeaderMargin(18.0);
double headerMargin = pageSettings.getHeaderMargin();
Use this property to set the spacing reserved for the header area in these page settings.
PageSettings pageSettings = new PageSettings();
pageSettings.setHeaderMargin(18.0);
value - The header margin size, in points.Use this property together with getPaperHeight() to determine the paper dimensions currently applied to the page.
PageSettings pageSettings = new PageSettings();
pageSettings.setPaperWidth(595.0);
double paperWidth = pageSettings.getPaperWidth();
Use this property together with getPaperHeight() to determine the paper dimensions currently applied to the page.
PageSettings pageSettings = new PageSettings();
pageSettings.setPaperWidth(595.0);
value - The width of the paper, in points, considered page orientation.Use this property together with getPaperWidth() to determine the paper dimensions currently applied to the page.
PageSettings pageSettings = new PageSettings();
pageSettings.setPaperHeight(842.0);
double paperHeight = pageSettings.getPaperHeight();
Use this property together with getPaperWidth() to determine the paper dimensions currently applied to the page.
PageSettings pageSettings = new PageSettings();
pageSettings.setPaperHeight(842.0);
value - The height of the paper, in points, considered page orientation.