Export print area range to HTML
Export print area range to HTML
Aspose.Cells for Python via Java supports exporting only the print area i.e. selected range of cells instead of the entire she’st to HTML. For this, the API provides the HtmlSaveOptions.ExportPrintAreaOnly property. Setting this property to True will only export the print area.
The following sample code demonstrates the use of the HtmlSaveOptions.ExportPrintAreaOnly property to export only the print area to HTML.
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) |