PageSetup class

PageSetup class

Encapsulates the object that represents the page setup description. The PageSetup object contains all page setup options.

The PageSetup type exposes the following members:

Properties

PropertyDescription
ods_page_backgroundGets the background of ODS.
print_areaRepresents the range to be printed.
print_title_columnsRepresents the columns that contain the cells to be repeated on the left side of each page.
print_title_rowsRepresents the rows that contain the cells to be repeated at the top of each page.
black_and_whiteRepresents if elements of the document will be printed in black and white.
center_horizontallyRepresent if the sheet is printed centered horizontally.
center_verticallyRepresent if the sheet is printed centered vertically.
print_draftRepresents if the sheet will be printed without graphics.
footer_marginRepresents the distance from the bottom of the page to the footer, in unit of centimeters.
footer_margin_inchRepresents the distance from the bottom of the page to the footer, in unit of inches.
header_marginRepresents the distance from the top of the page to the header, in unit of centimeters.
header_margin_inchRepresents the distance from the top of the page to the header, in unit of inches.
printer_settingsGets and sets the settings of the default printer.
left_marginRepresents the size of the left margin, in unit of centimeters.
left_margin_inchRepresents the size of the left margin, in unit of inches.
right_marginRepresents the size of the right margin, in unit of centimeters.
right_margin_inchRepresents the size of the right margin, in unit of inches.
top_marginRepresents the size of the top margin, in unit of centimeters.
top_margin_inchRepresents the size of the top margin, in unit of inches.
bottom_marginRepresents the size of the bottom margin, in unit of centimeters.
bottom_margin_inchRepresents the size of the bottom margin, in unit of inches.
first_page_numberRepresents the first page number that will be used when this sheet is printed.
fit_to_pages_tallRepresents the number of pages tall the worksheet will be scaled to when it’s printed.
The default value is 1.
fit_to_pages_wideRepresents the number of pages wide the worksheet will be scaled to when it’s printed.
The default value is 1.
is_percent_scaleIf this property is False, the FitToPagesWide and FitToPagesTall properties control how the worksheet is scaled.
orderRepresents the order that Microsoft Excel uses to number pages when printing a large worksheet.
is_automatic_paper_sizeIndicates whether the paper size is automatic.
paper_sizeRepresents the size of the paper.
paper_widthGets the width of the paper in unit of inches, considered page orientation.
paper_heightGets the height of the paper in unit of inches , considered page orientation.
orientationRepresents page print orientation.
print_commentsRepresents the way comments are printed with the sheet.
print_errorsSpecifies the type of print error displayed.
print_headingsRepresents if row and column headings are printed with this page.
print_gridlinesRepresents if cell gridlines are printed on the page.
zoomRepresents the scaling factor in percent. It should be between 10 and 400.
is_auto_first_page_numberIndicates whether the first the page number is automatically assigned.
print_qualityRepresents the print quality.
print_copiesGet and sets number of copies to print.
is_hf_diff_odd_evenTrue means that the header/footer of the odd pages is different with odd pages.
is_hf_diff_firstTrue means that the header/footer of the first page is different with other pages.
is_hf_scale_with_docIndicates whether header and footer are scaled with document scaling.
Only applies for Excel 2007.
is_hf_align_marginsIndicates whether header and footer margins are aligned with the page margins.
If this property is true, the left header and footer will be aligned with the left margin,
and the right header and footer will be aligned with the right margin.
This option is enabled by default.

Methods

MethodDescription
get_pictureGets the Picture object of the header / footer.
get_pictureGets the Picture object of the header / footer.
copyCopies the setting of the page setup.
set_fit_to_pagesSets the number of pages the worksheet will be scaled to when it’s printed.
custom_paper_sizeSets the custom paper size, in unit of inches.
clear_header_footerClears header and footer setting.
get_headerGets a script formatting the header of an Excel file.
get_commandsGets all commands of header or footer.
get_footerGets a script formatting the footer of an Excel file.
set_headerSets a script formatting the header of an Excel file.
set_footerSets a script formatting the footer of an Excel file.
set_even_headerSets a script formatting the even page header of an Excel file.
Only effect in Excel 2007 when IsHFDiffOddEven is true.
get_even_headerGets a script formatting the even header of an Excel file.
set_even_footerSets a script formatting the even page footer of an Excel file.
Only effect in Excel 2007 when IsHFDiffOddEven is true.
get_even_footerGets a script formatting the even footer of an Excel file.
set_first_page_headerSets a script formatting the first page header of an Excel file.
Only effect in Excel 2007 when IsHFDiffFirst is true.
get_first_page_headerGets a script formatting the first page header of an Excel file.
set_first_page_footerSets a script formatting the first page footer of an Excel file.
get_first_page_footerGets a script formatting the first page footer of an Excel file.
set_header_pictureSets an image in the header of a worksheet.
set_footer_pictureSets an image in the footer of a worksheet.
set_pictureSets an image in the header/footer of a worksheet.

Example

from aspose.cells import Workbook

workbook = Workbook()
sheets = workbook.worksheets
# Add a worksheet
sheets.add()
sheet = sheets[1]
pageSetup = sheet.page_setup
pageSetup.print_area = "D1:K13"

See Also