导出打印区域范围为HTML
Contents
[
Hide
]
导出打印区域范围为HTML
Aspose.Cells for Python via Java 支持仅导出打印区域,即选定的单元格范围,而不是整个她到 HTML。为此,API 提供了HtmlSaveOptions.ExportPrintAreaOnly财产。将此属性设置为真的只会导出打印区域。
下面的示例代码演示了使用HtmlSaveOptions.ExportPrintAreaOnly属性仅将打印区域导出到 HTML。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source_directory = "Examples/SampleFiles/SourceDirectory/" | |
output_directory = "Examples/SampleFiles/OutputDirectory/" | |
# Load the Sample Workbook | |
workbook = Workbook(source_directory + "sampleInlineCharts.xlsx") | |
# Access the firs worksheet | |
worksheet = workbook.getWorksheets().get(0) | |
# Set the print area. | |
worksheet.getPageSetup().setPrintArea("D2:M20") | |
# Initialize HtmlSaveOptions | |
saveOptions = HtmlSaveOptions() | |
# Set flag to export print area only | |
saveOptions.setExportPrintAreaOnly(True) | |
# Save the excel file. | |
workbook.save(output_directory + "outputInlineCharts.html", saveOptions) |