[]
Provides access to worksheet print and pagination settings, including paper size, orientation, margins, headers and footers, print area, repeated title rows and columns, page order, and scaling options used when printing or exporting a worksheet.
Use IWorksheet.getPageSetup() to obtain the page setup for a worksheet and configure its printing behavior.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setOrientation(PageOrientation.Landscape);
pageSetup.setPrintTitleRows("$1:$1");
pageSetup.setFitToPagesWide(1);
pageSetup.setFitToPagesTall(0);
voidcustomPaperSize(double width,
double height) voidbooleanbooleanbooleanbooleandoubleIPageSetup object.IGraphic object that represents the picture for the center section of the footer.IPageSetup object.IGraphic object that represents the picture for the center section of the header.booleanbooleanbooleanbooleangetDraft()IPage of a workbook or section.IPage of a workbook or section.intintintdoubledoublebooleanbooleanIPageSetup object.IGraphic object that represents the picture for the left section of the footer.IPageSetup object.IGraphic object that represents the picture for the left section of the header.doublebooleangetOrder()Order value that represents the order used to number pages when printing a large worksheet.PageOrientation value that represents the portrait or landscape printing mode.doubledoubleintPrintErrors constant specifying how cell error values are displayed when the worksheet is printed.booleanbooleanbooleanPrintQuality value that represents the print quality of this page.IPageSetup object.IGraphic object that represents the picture for the right section of the footer.IPageSetup object.IGraphic object that represents the picture for the right section of the header.doublebooleandoubleintgetZoom()voidsetAlignMarginsHeaderFooter(boolean value) voidsetBestFitColumns(boolean value) voidsetBestFitRows(boolean value) voidsetBlackAndWhite(boolean value) voidsetBottomMargin(double value) voidsetCenterFooter(String value) voidsetCenterHeader(String value) IPageSetup object.voidsetCenterHorizontally(boolean value) voidsetCenterVertically(boolean value) voidsetDifferentFirstPageHeaderFooter(boolean value) voidsetDraft(boolean value) voidsetFirstPageNumber(int value) voidsetFitToPagesTall(int value) voidsetFitToPagesWide(int value) voidsetFooterMargin(double value) voidsetHeaderMargin(double value) voidsetIsAutoFirstPageNumber(boolean value) voidsetIsPercentScale(boolean value) voidsetLeftFooter(String value) IPageSetup object.voidsetLeftHeader(String value) voidsetLeftMargin(double value) voidsetOddAndEvenPagesHeaderFooter(boolean value) voidOrder value that represents the order used to number pages when printing a large worksheet.voidsetOrientation(PageOrientation value) PageOrientation value that represents the portrait or landscape printing mode.voidsetPaperSize(PaperSize value) voidsetPrintArea(String value) voidsetPrintComments(PrintLocation value) voidsetPrintCopies(int value) voidsetPrintErrors(PrintErrors value) PrintErrors constant specifying how print errors are displayed.voidsetPrintGridlines(boolean value) voidsetPrintHeadings(boolean value) voidsetPrintNotes(boolean value) voidsetPrintPageRange(String value) voidsetPrintQuality(PrintQuality value) PrintQuality value that represents the print quality of this page.voidsetPrintTailColumns(String value) voidsetPrintTailRows(String value) voidsetPrintTitleColumns(String value) voidsetPrintTitleRows(String value) voidsetRightFooter(String value) IPageSetup object.voidsetRightHeader(String value) voidsetRightMargin(double value) voidsetScaleWithDocHeaderFooter(boolean value) voidsetTopMargin(double value) voidsetZoom(int value) toJson()PrintQuality value that represents the print quality of this page. Default is 600 dpi. Use this property to determine the current page print resolution that will be applied when the worksheet is printed.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintQuality(PrintQuality.Dpi144);
PrintQuality printQuality = pageSetup.getPrintQuality();
PrintQuality value for this page. The default value is PrintQuality.Dpi600.PrintQuality value that represents the print quality of this page. Default is 600 dpi.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintQuality(PrintQuality.Dpi144);
value - The PrintQuality value that represents the print quality of this page.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setBlackAndWhite(true);
boolean blackAndWhite = pageSetup.getBlackAndWhite();
true if elements of the document will be printed in black and white; otherwise, false.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setBlackAndWhite(true);
value - true if elements of the document will be printed in black and white; otherwise, false.This value specifies the left page margin used for printing and can be configured with setLeftMargin(double).
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setLeftMargin(36);
double leftMargin = pageSetup.getLeftMargin();
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setLeftMargin(36);
value - The size of the left margin, in points.This value specifies the right page margin used for printing and can be configured with setRightMargin(double).
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setRightMargin(36);
double rightMargin = pageSetup.getRightMargin();
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setRightMargin(36);
value - The size of the right margin, in points.This value specifies the top page margin used for printing and can be configured with setTopMargin(double).
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setTopMargin(36);
double topMargin = pageSetup.getTopMargin();
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setTopMargin(36);
value - The size of the top margin, in points.This value specifies the bottom page margin used for printing and can be configured with setBottomMargin(double).
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setBottomMargin(36);
double bottomMargin = pageSetup.getBottomMargin();
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setBottomMargin(36);
value - The size of the bottom margin, in points.Use this method to retrieve the current header margin configured in the page setup for printing.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setHeaderMargin(18);
double headerMargin = pageSetup.getHeaderMargin();
Use this method to set the header margin configured in the page setup for printing.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setHeaderMargin(18);
value - The size of the header margin, in points.IPageSetup object.Use this property to retrieve the centered header content for the worksheet's page setup.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setCenterHeader("Quarterly Report");
String centerHeader = pageSetup.getCenterHeader();
IPageSetup object.Use this property to set the centered header content for the worksheet's page setup.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setCenterHeader("Quarterly Report");
value - The text in the center header section. Sets an empty string if no center header text is set.IPageSetup object.The returned string represents the current left header content configured in the page setup. It can include header text and any header codes that were set for printing.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setLeftHeader("&\"Arial,Italic\"Sales Report");
String leftHeader = pageSetup.getLeftHeader();
Sets the string configured for the left header when the worksheet is printed. The returned value can include header text and any header codes that were set for printing.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setLeftHeader("&\"Arial,Italic\"Sales Report");
value - The left header string for the page setup.IPageSetup object.Use this method to retrieve the text displayed in the right section of the page header.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setRightHeader("Page &[Page]");
String rightHeader = pageSetup.getRightHeader();
Sets the text displayed in the right section of the page header.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setRightHeader("Page &[Page]");
value - The text in the right section of the page header. Sets an empty string if the right header is not set.This property indicates whether the worksheet content is horizontally centered within the printable page area during printing.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setCenterHorizontally(true);
boolean centerHorizontally = pageSetup.getCenterHorizontally();
true if the sheet is centered horizontally on the page when printed; otherwise, false.This property indicates whether the worksheet content is horizontally centered within the printable page area during printing.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setCenterHorizontally(true);
value - true if the sheet is centered horizontally on the page when printed; otherwise, false.This property indicates whether the worksheet content is vertically centered within the printable page area during printing.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setCenterVertically(true);
boolean centerVertically = pageSetup.getCenterVertically();
true if the sheet is centered vertically on the printed page; otherwise, false.This property indicates whether the worksheet content is vertically centered within the printable page area during printing.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setCenterVertically(true);
value - true if the sheet is centered vertically on the printed page; otherwise, false.When this property returns true, the worksheet is printed in draft mode.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setDraft(true);
boolean draft = pageSetup.getDraft();
true if the sheet is printed without graphics; otherwise, false.When this property Sets true, the worksheet is printed in draft mode.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setDraft(true);
value - true if the sheet is printed without graphics; otherwise, false.If Automatic, Document Solutions for Excel chooses the first page number. The default is Automatic.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setIsAutoFirstPageNumber(false);
pageSetup.setFirstPageNumber(3);
int firstPageNumber = pageSetup.getFirstPageNumber();
If Automatic, Document Solutions for Excel chooses the first page number. The default is Automatic.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setIsAutoFirstPageNumber(false);
pageSetup.setFirstPageNumber(3);
value - The first page number to use when this sheet is printed. If automatic page numbering is enabled, Document Solutions for Excel chooses the first page number.The default value is true. When the first page number is specified, this method returns false.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setFirstPageNumber(3);
boolean isAutoFirstPageNumber = pageSetup.getIsAutoFirstPageNumber();
true if the first page number is assigned automatically; false if a specific first page number has been specified.The default value is true. When the first page number is specified, this method Sets false.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setFirstPageNumber(3);
pageSetup.setIsAutoFirstPageNumber(true);
value - true if the first page number is assigned automatically; false if a specific first page number has been specified.This setting is used when worksheet scaling is controlled by setIsPercentScale(boolean) instead of a zoom percentage.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setIsPercentScale(false);
pageSetup.setFitToPagesTall(2);
int pagesTall = pageSetup.getFitToPagesTall();
This setting is used when worksheet scaling is controlled by setIsPercentScale(boolean) instead of a zoom percentage.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setIsPercentScale(false);
pageSetup.setFitToPagesTall(2);
value - The number of pages tall the worksheet will be scaled to when printed.This value specifies the maximum number of pages for horizontal pagination. When getIsPercentScale() returns false, the worksheet uses getFitToPagesWide() together with getFitToPagesTall() to control fit-to-page scaling.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setIsPercentScale(false);
pageSetup.setFitToPagesWide(3);
int pagesWide = pageSetup.getFitToPagesWide();
This value specifies the maximum number of pages for horizontal pagination. When getIsPercentScale() Sets false, the worksheet uses getFitToPagesWide() together with getFitToPagesTall() to control fit-to-page scaling.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setIsPercentScale(false);
pageSetup.setFitToPagesWide(3);
value - The number of pages wide the worksheet will be scaled to when printed.If this property is true, the worksheet uses percentage-based scaling. If this property is false, the getFitToPagesWide() and getFitToPagesTall() settings control how the worksheet is scaled.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setIsPercentScale(true);
boolean isPercentScale = pageSetup.getIsPercentScale();
true if the worksheet is scaled as a percentage; false if getFitToPagesWide() and getFitToPagesTall() control how the worksheet is scaled.If this property is true, the worksheet uses percentage-based scaling. If this property is false, the getFitToPagesWide() and getFitToPagesTall() settings control how the worksheet is scaled.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setIsPercentScale(true);
value - If this property is true, the worksheet is scaled as a percentage; getFitToPagesWide() and getFitToPagesTall() control how the worksheet is scaled.Order value that represents the order used to number pages when printing a large worksheet.This property determines whether pages are numbered down the rows before moving across columns, or across columns before moving down the rows.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setOrder(Order.OverThenDown);
Order order = pageSetup.getOrder();
Order.DownThenOver when the page order is not explicitly set.Order value that represents the order used to number pages when printing a large worksheet.Use this method to control whether pages are numbered down the rows first or across the columns first when the worksheet spans multiple printed pages.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setOrder(Order.OverThenDown);
value - The page numbering order to use when printing a large worksheet.PageOrientation value that represents the portrait or landscape printing mode. Use this method to retrieve the current page orientation configured for the worksheet's page setup.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setOrientation(PageOrientation.Landscape);
PageOrientation orientation = pageSetup.getOrientation();
PageOrientation value that represents the portrait or landscape printing mode.PageOrientation value that represents the portrait or landscape printing mode. Use this method to control how the worksheet page is oriented when it is printed or exported to paginated formats.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setOrientation(PageOrientation.Landscape);
value - The page orientation to apply.Use this method to retrieve the current PaperSize setting that is used for page setup when the worksheet is printed.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPaperSize(PaperSize.A4);
PaperSize paperSize = pageSetup.getPaperSize();
Use this method to select a built-in PaperSize for printing or page layout. To define a custom size in inches, use customPaperSize(double,double) instead.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPaperSize(PaperSize.A4);
value - The built-in paper size to use.This method applies a user-defined paper size for the page setup. After calling this method, getPaperWidth() and getPaperHeight() return the specified custom dimensions.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.customPaperSize(8.5, 13);
double paperWidth = pageSetup.getPaperWidth();
double paperHeight = pageSetup.getPaperHeight();
width - The paper width, in inches. Must be greater than 0.height - The paper height, in inches. Must be greater than 0.RuntimeException - if width or height is less than or equal to 0.If a custom paper size is set by customPaperSize(double,double), this method returns the configured paper width.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.customPaperSize(8.5, 13);
double paperWidth = pageSetup.getPaperWidth();
If a custom paper size is set by customPaperSize(double,double), this method returns the configured paper height.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.customPaperSize(8.5, 13);
double paperHeight = pageSetup.getPaperHeight();
Use this method to determine whether worksheet gridlines are included in printed output.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintGridlines(true);
boolean printGridlines = pageSetup.getPrintGridlines();
true if cell gridlines are printed on the page; otherwise, false.Use this method to set whether worksheet gridlines are included in printed output.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintGridlines(true);
value - true if cell gridlines are printed on the page; otherwise, false.Applies only to worksheets.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintHeadings(true);
boolean printHeadings = pageSetup.getPrintHeadings();
true if row and column headings are printed with the page; otherwise, false.Applies only to worksheets.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintHeadings(true);
value - true if row and column headings are printed with the page; otherwise, false.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintNotes(true);
boolean printNotes = pageSetup.getPrintNotes();
true if cell notes are printed as end notes with the sheet; otherwise, false.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintNotes(true);
value - true if cell notes are printed as end notes with the sheet; otherwise, false.If the print area is not specified, the used range of the worksheet is printed by default.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintArea("$A$1:$C$10");
String printArea = pageSetup.getPrintArea();
If the print area is not specified, the used range of the worksheet is printed by default.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintArea("$A$1:$C$10");
value - The print area as an A1-style reference string in the language of the macro.Use setPrintTitleColumns(String) to define the repeated columns for printed pages.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintTitleColumns("$A:$B");
String printTitleColumns = pageSetup.getPrintTitleColumns();
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintTitleColumns("$A:$B");
value - A string in A1-style notation that specifies the print title columns.Use this method to retrieve the current repeating row setting for the worksheet page setup.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintTitleRows("$1:$2");
String printTitleRows = pageSetup.getPrintTitleRows();
Use this method to set the repeating row setting for the worksheet page setup.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintTitleRows("$1:$2");
value - The rows to repeat at the top of each page, expressed as an A1-style row reference string in the language of the macro.Use this property to read the current right-side repeating column setting for the worksheet page setup.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintTailColumns("$I:$J");
String printTailColumns = pageSetup.getPrintTailColumns();
Use this property to set the right-side repeating column setting for the worksheet page setup.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintTailColumns("$I:$J");
value - A string that specifies the columns to repeat on the right side of each page in A1-style notation.Use this method to retrieve the bottom repeating rows configured for the worksheet page setup.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintTailRows("$50:$50");
String printTailRows = pageSetup.getPrintTailRows();
Use this method to set the bottom repeating rows configured for the worksheet page setup.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintTailRows("$50:$50");
value - A string that specifies the bottom repeating rows in A1-style notation in the language of the macro.Returns the print copies setting for the worksheet page setup. If no page setup has been created, this method returns 1.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintCopies(3);
int printCopies = pageSetup.getPrintCopies();
1 if no page setup has been created.Sets the print copies setting for the worksheet page setup. If no page setup has been created, this method Sets 1.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintCopies(3);
value - The number of copies to print. Sets 1 if no page setup has been created.Use this property to retrieve the page-range string that controls which pages are included in the print operation. For example, "1,3,5-12" prints page 1, page 3, and pages 5 through 12.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintPageRange("1,3-5");
String printPageRange = pageSetup.getPrintPageRange();
Use this property to set the page-range string that controls which pages are included in the print operation.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintPageRange("1,3-5");
value - The print page range string.This property is used when the worksheet is scaled as a percentage. If getIsPercentScale() returns false, scaling is controlled by getFitToPagesWide() and getFitToPagesTall() instead.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setIsPercentScale(true);
pageSetup.setZoom(125);
int zoom = pageSetup.getZoom();
This property is used when the worksheet is scaled as a percentage. If getIsPercentScale() Sets false, scaling is controlled by getFitToPagesWide() and getFitToPagesTall() instead.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setIsPercentScale(true);
pageSetup.setZoom(125);
value - The print scaling percentage, from 10 to 400.Use this property to determine whether comments are not printed, printed as end notes, or printed in place on the worksheet. If the page setup has not been initialized, this method returns PrintLocation.NoComments.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintComments(PrintLocation.SheetEnd);
PrintLocation printComments = pageSetup.getPrintComments();
PrintLocation value that indicates how comments are printed with the sheet.Use this method to control whether worksheet comments are printed in place, printed as end notes, or omitted when the worksheet is printed.
IRange cell = worksheet.getRange("A1");
cell.addComment("Check the total before printing.");
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintComments(PrintLocation.SheetEnd);
value - The print location to apply to worksheet comments when printing. Must be a valid PrintLocation value; null is not supported.PrintErrors constant specifying how cell error values are displayed when the worksheet is printed.This setting can be used to suppress the display of error values during printing, for example by showing blanks, dashes, or #N/A instead of the original error values.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintErrors(PrintErrors.Dash);
PrintErrors printErrors = pageSetup.getPrintErrors();
PrintErrors value that specifies how print errors are displayed. Returns PrintErrors.Displayed if no explicit page setup has been created.PrintErrors constant specifying how print errors are displayed.This feature allows users to suppress the display of error values when printing a worksheet.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setPrintErrors(PrintErrors.Dash);
value - The print error display mode.IGraphic object that represents the picture for the center section of the header. Used to set attributes about the picture. Use the returned IGraphic object to set attributes of the picture, such as the image source or size.
IPageSetup pageSetup = worksheet.getPageSetup();
IGraphic picture = pageSetup.getCenterHeaderPicture();
picture.setFilename(java.nio.file.Paths.get("Users", "DefaultApps", "Documents", "logo.png").toString());
picture.setWidth(36);
IGraphic object that represents the picture for the center section of the header.IGraphic object that represents the picture for the left section of the header. Used to set attributes about the picture. Use the returned IGraphic object to set attributes of the picture, such as the image source or size.
IPageSetup pageSetup = worksheet.getPageSetup();
IGraphic picture = pageSetup.getLeftHeaderPicture();
picture.setFilename(java.nio.file.Paths.get("Users", "DefaultApps", "Documents", "logo.png").toString());
picture.setWidth(36);
IGraphic object that represents the picture for the left section of the header.IGraphic object that represents the picture for the right section of the header. Used to set attributes of the picture. Use the returned IGraphic object to set attributes of the picture, such as the image source or size.
IPageSetup pageSetup = worksheet.getPageSetup();
IGraphic picture = pageSetup.getRightHeaderPicture();
picture.setFilename(java.nio.file.Paths.get("Users", "DefaultApps", "Documents", "logo.png").toString());
picture.setWidth(36);
IGraphic object that represents the picture for the right section of the header.IPage of a workbook or section. Use the returned IPage object to configure headers and footers for even pages when odd and even page headers and footers are enabled.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setOddAndEvenPagesHeaderFooter(true);
IPage evenPage = pageSetup.getEvenPage();
evenPage.getCenterHeader().setText("Even Page");
IPage object that represents the even page header and footer settings.IPage of a workbook or section. Use the returned IPage object to configure headers and footers for the first page when a different first page header and footer is enabled.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setDifferentFirstPageHeaderFooter(true);
IPage firstPage = pageSetup.getFirstPage();
firstPage.getCenterHeader().setText("Cover Page");
IPage object that represents the first page header and footer settings.When this property is true, the worksheet uses best-fit column widths during printing.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setBestFitColumns(true);
boolean bestFitColumns = pageSetup.getBestFitColumns();
true if column widths are adjusted to fit the longest text width for printing; otherwise, false.When this property is true, the worksheet uses best-fit column widths during printing.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setBestFitColumns(true);
value - true if column widths are adjusted to fit the longest text width for printing; otherwise, false.When this property is true, the page setup automatically adjusts row heights to accommodate the tallest text when the worksheet is printed.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setBestFitRows(true);
boolean bestFitRows = pageSetup.getBestFitRows();
true if row heights are adjusted to fit the tallest text height for printing; otherwise, false.When this property is true, the page setup automatically adjusts row heights to accommodate the tallest text when the worksheet is printed.
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setBestFitRows(true);
value - true if row heights are adjusted to fit the tallest text height for printing; otherwise, false.Use this method to apply page setup settings from serialized JSON data, such as JSON produced by toJson().
IPageSetup pageSetup = worksheet.getPageSetup();
String json = "{\"bestFitRows\":true,\"bestFitColumns\":true,"
+ "\"margin\":{\"top\":36,\"bottom\":36,\"left\":30,\"right\":30}}";
pageSetup.fromJson(json);
json - The JSON string representing the page setup.Use this method to serialize the current page setup settings to JSON so that they can be stored or later applied by using fromJson(String).
IPageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setBlackAndWhite(true);
pageSetup.setLeftHeader("Quarterly Report");
String json = pageSetup.toJson();