EasyXLS

Page setup

EasyXLS™ library provides the methods for setting the page setup options such as page orientation (portrait and landscape), paper size, scaling factor, fit paper width and paper height, paper margins, print area, rows to be repeated, print order, print gridlines, black and white printing, draft quality, row and column headings and comments printing.

Source code sample

The below example shows how to export an Excel file with a specified print area, rows repeated at top, page orientation as portrait, paper size as A4 and other related settings.

C#.NET
VB.NET
C++
Java
PHP
ASP
VB6
VBS
Coldfusion
Python

The screen shot provides an example of an Excel report that has the following page setup options for a worksheet: print area, rows to be repeated at top, center horizontally, page orientation (portrait), page order (down), paper size (A4), print comments and gridlines, page break at row 21.

Excel print area, page orientation (portrait, landscape), paper size

Page orientation

EasyXLS allows setting the page orientation as portrait or landscape using ExcelPageSetup.setOrientation method.

Page scaling

EasyXLS allows scaling the page by zoom using ExcelPageSetup.setScalingFactor. It also allows to scale the page automatically by page content using ExcelPageSetup.setFitToPagesHeight and ExcelPageSetup.setFitToPagesWidth methods.

Paper size

EasyXLS allows setting the paper size to A4, A5, letter and other page formats using ExcelPageSetup.setPaperSize method.

Page margins

EasyXLS allows setting the page margins: top and bottom margins, left and right margins accordantly using ExcelPageSetup.setTopMargin, ExcelPageSetup.setBottomMargin, ExcelPageSetup.setLeftMargin, ExcelPageSetup.setRightMargin methods.

It also allows setting the header and footer size using ExcelPageSetup.setHeaderMargin and ExcelPageSetup.setFooterMargin methods.

Header and footer

EasyXLS allows setting the header and footer sections.

Print area

EasyXLS allows setting the print area for the sheet using ExcelPageSetup.easy_setPrintArea method.

For multiple cell ranges in print area, the range parameter must be passed to the method as union of ranges (multiple ranges separated by comma).

Row and columns repeated when printing

EasyXLS allows you to set the rows to be repeated at top of the page and the columns to be repeated at left of the page when the Excel file is printed using ExcelPageSetup.easy_setRowsToRepeatAtTop methods and ExcelPageSetup.easy_setColumnsToRepeatAtLeft methods respectively.

Page break preview

In order to visualize the printable area and the pagination, the view must be set on "Page Break Preview" mode using ExcelWorksheet.setPageBreakPreview method.

 

Available for: Professional, Excel Writer, Excel Reader
Go to top

EasyXLS Excel libraries:

.NET
.NET Excel Library
full .NET version to import, export or convert Excel files
COM+ Excel Library
full COM+ version to import, export or convert Excel files
-
Java
Java Excel Library
full Java version to import, export or convert Excel files
Download EasyXLS™ Excel Library for .NET and Java

File formats:

Office 365
MS Excel 2021 - 2024
MS Excel 2007 - 2019
MS Excel 97 - 2003
XLSXXLSMXLSBXLS
XMLHTMLCSVTXT