PageSetup类

PageSetup类

封装代表页面设置描述的对象。 PageSetup 对象包含所有页面设置选项。

PageSetup 类型公开以下成员:

属性

属性描述
ods_page_background获取ODS的背景。
print_area代表要打印的范围。
print_title_columns表示包含要在每页左侧重复的单元格的列。
print_title_rows表示包含要在每页顶部重复的单元格的行。
black_and_white表示文档元素是否以黑白打印。
center_horizontally表示纸张是否水平居中打印。
center_vertically表示纸张是否垂直居中打印。
print_draft表示是否打印不带图形的纸张。
footer_margin表示从页面底部到页脚的距离,以厘米为单位。
footer_margin_inch表示从页面底部到页脚的距离,以英寸为单位。
header_margin表示从页面顶部到页眉的距离,以厘米为单位。
header_margin_inch表示从页面顶部到页眉的距离,以英寸为单位。
printer_settings获取并设置默认打印机的设置。
left_margin表示左边距的大小,以厘米为单位。
left_margin_inch表示左边距的大小,以英寸为单位。
right_margin表示右边距的大小,以厘米为单位。
right_margin_inch表示右边距的大小,单位为英寸。
top_margin表示上边距的大小,以厘米为单位。
top_margin_inch表示上边距的大小,以英寸为单位。
bottom_margin表示下边距的大小,以厘米为单位。
bottom_margin_inch表示下边距的大小,以英寸为单位。
first_page_number表示打印此工作表时将使用的第一个页码。
fit_to_pages_tall表示工作表打印时将缩放到的页数。
默认值为 1。
fit_to_pages_wide表示打印时工作表将缩放到的页数。
默认值为 1。
is_percent_scale如果此属性为 False,则 FitToPagesWide 和 FitToPagesTall 属性控制工作表的缩放方式。
order表示 Microsoft Excel 在打印大型工作表时对页面进行编号的顺序。
is_automatic_paper_size指示纸张尺寸是否自动。
paper_size表示纸张的大小。
paper_width获取纸张的宽度(以英寸为单位),考虑页面方向。
paper_height获取纸张的高度(以英寸为单位),考虑页面方向。
orientation表示页面打印方向。
print_comments表示注释随工作表一起打印的方式。
print_errors指定显示的打印错误类型。
print_headings表示是否随此页面打印行标题和列标题。
print_gridlines表示单元格网格线是否打印在页面上。
zoom表示缩放因子(以百分比表示)。该值应介于 10 到 400 之间。
is_auto_first_page_number指示是否自动分配第一个页码。
print_quality代表打印质量。
print_copies获取并设置要打印的份数。
is_hf_diff_odd_evenTrue 表示奇数页的页眉/页脚与奇数页不同。
is_hf_diff_firstTrue 表示第一页的页眉/页脚与其他页面不同。
is_hf_scale_with_doc指示页眉和页脚是否随文档缩放而缩放。
仅适用于 Excel 2007。
is_hf_align_margins指示页眉和页脚边距是否与页边距对齐。
如果此属性为真,则左页眉和页脚将与左边距对齐,
并且右页眉和右页脚将与右边距对齐。
默认情况下启用此选项。

方法

方法描述
get_picture(self, is_header, section)获取页眉/页脚的 Picture 对象。
get_picture(self, is_first, is_even, is_header, section)获取页眉/页脚的 Picture 对象。
copy(self, source, copy_options)复制页面设置的设置。
set_fit_to_pages(self, wide, tall)设置工作表打印时的页数。
custom_paper_size(self, width, height)设置自定义纸张尺寸,以英寸为单位。
clear_header_footer(self)清除页眉和页脚设置。
get_header(self, section)获取格式化 Excel 文件标题的脚本。
get_commands(self, header_footer_script)获取页眉或页脚的所有命令。
get_footer(self, section)获取格式化 Excel 文件页脚的脚本。
set_header(self, section, header_script)设置格式化 Excel 文件标题的脚本。
set_footer(self, section, footer_script)设置格式化 Excel 文件页脚的脚本。
set_even_header(self, section, header_script)设置格式化 Excel 文件偶数页页眉的脚本。
仅当 IsHFDiffOddEven 为真时在 Excel 2007 中有效。
get_even_header(self, section)获取格式化 Excel 文件事件头的脚本。
set_even_footer(self, section, footer_script)设置格式化 Excel 文件偶数页页脚的脚本。
仅当 IsHFDiffOddEven 为真时在 Excel 2007 中有效。
get_even_footer(self, section)获取格式化 Excel 文件偶数页脚的脚本。
set_first_page_header(self, section, header_script)设置格式化 Excel 文件第一页页眉的脚本。
仅当 IsHFDiffFirst 为真时在 Excel 2007 中有效。
get_first_page_header(self, section)获取格式化 Excel 文件首页页眉的脚本。
set_first_page_footer(self, section, footer_script)设置格式化 Excel 文件第一页页脚的脚本。
get_first_page_footer(self, section)获取格式化 Excel 文件第一页页脚的脚本。
set_header_picture(self, section, header_picture)在工作表的标题中设置图像。
set_footer_picture(self, section, footer_picture)在工作表的页脚中设置图像。
set_picture(self, is_first, is_even, is_header, section, image_data)在工作表的页眉/页脚中设置图像。

例子

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"

也可以看看