File Operations / Working With Page Setup
Working With Page Setup

DsExcel Java allows users to paginate each worksheet using the methods of the IPageSetup interface.

While exporting a spreadsheet to a PDF file, you can customize the page size, print area, print title rows, print title columns; set horizontal page breaks, vertical page breaks, the maximum number of pages for horizontal and vertical pagination etc. along with zoom and scale factors as per your preferences. 

In order to set pagination in a workheet, users can explore the following methods of the IPageSetup interface and the IWorksheet interface:

Methods Descriptions

IPageSetup.getPaperSize

IPageSetup.setPaperSize

Used to get or set the size of each page. For more information on implementation, refer to Configure Paper Size.

IPageSetup.getOrientation

IPageSetup.setOrientation

Used to get or set whether the worksheet should be printed in landscape orientation or portrait orientation. For more information on implementation, refer to Configure Page Orientation.

IPageSetup.getPrintTitleRows

IPageSetup.setPrintTitleRows

Used to get or set the rows that you want to print at the top of each page. For more information on implementation, refer to Configure Rows to Repeat at Top.

IPageSetup.getPrintTitleColumns

IPageSetup.setPrintTitleColumns

Used to get or set the columns that you want to print at the left of each page. For more information on implementation, refer to Configure Columns to Repeat at Left.

IPageSetup.getPrintArea

IPageSetup.setPrintArea

Used to get or set the print area in a worksheet. If the print area is not specified by the user, the used range of the sheet is printed by default. For more information on implementation, refer to Configure Print Area.

IPageSetup.getZoom

IPageSetup.setZoom

Used to get or set the result of zoom while paginating a worksheet. For more information on implementation, refer to Configure Paper Scaling.

IPageSetup.getFitToPagesWide

IPageSetup.setFitToPagesWide

Used to get or set the maximum number of pages for horizontal pagination. After this method is set, the worksheet can be scaled to fit all columns to the pages. For more information on implementation, refer to Configure Paper Scaling.

IPageSetup.getFitToPagesTall

IPageSetup.setFitToPagesTall

Used to get or set the maximum number of pages for vertical pagination. After this method is set, the worksheet can be scaled to fit all rows to the pages. For more information on implementation, refer to Configure Paper Scaling.

IPageSetup.getIsPercentScale

 

IPageSetup.setIsPercentScale

Used to get or set a boolean value to control how the worksheet is scaled while exporting to PDF.

If the value is set to True, you can use the Zoom method of the IPageSetup interface and if the value is set to false, you can use the FitToPagesWide and FitToPagesTall method of the IPageSetup interface. For more information on implementation, refer to Configure Paper Scaling.

IWorksheet.getHPageBreaks

Used to get the horizontal page breaks that will split rows to multiple pages. However, this method doesn't work when the method setIsPercentScale is set to false. For more information on implementation, refer to Configure Page Breaks.

IWorksheet.getVPageBreaks

Used to get the vertical page breaks that will split columns to multiple pages. However, this method doesn't work when the method setIsPercentScale is set to false. For more information on implementation, refer to Configure Page Breaks

IPageSetup.getOrder

IPageSetup.setOrder

Used to get or set the page order for each page. For more information on implementation, refer to Configure Page Order.

IPageSetup.getBottomMargin 

IPageSetup.setBottomMargin

IPageSetup.getFooterMargin

IPageSetup.setFooterMargin

IPageSetup.getLeftMargin              

IPageSetup.setLeftMargin

IPageSetup.getHeaderMargin

IPageSetup.setHeaderMargin

IPageSetup.getRightMargin  

IPageSetup.setRightMargin

IPageSetup.getTopMargin

IPageSetup.setTopMargin

 

 

Used to get or set the bottom margins, footer margins, left margins, header margins, right margins and top margins for each page.                               

               

For more information on implementation of margins in a page, refer to Configure Page Margins.  

IPageSetup.getDraft    

IPageSetup.setDraft 

Used to get or set the drafts that are saved for each page. For more information on implementation, refer to Configure Drafts.

IPageSetup.getPrintPageRange   

IPageSetup.setPrintPageRange

Used to get or set the print page range while printing a worksheet. For more information on implementation, refer to Configure Print Page Range.

IPageSetup.getCenterHorizontally

IPageSetup.setCenterHorizontally

IPageSetup.getCenterVertically

IPageSetup.setCenterVertically

 

Used to get or set the page center for each page in horizontal and vertical directions. For more information on implementation, refer to Configure Page Center.

IPageSetup.getFirstPageNumber

IPageSetup.setFirstPageNumber

Used to get or set the first page number while exporting a worksheet to PDF or while printing a worksheet. For more information on implementation, refer to Configure First Page Number.

For more information on setting pagination, refer to Configure Print Settings via Page Setup.