Esporta l'intervallo dell'area di stampa in HTML

Esporta l’intervallo dell’area di stampa in HTML

Aspose.Cells for Python via Java supporta l’esportazione solo dell’area di stampa, ovvero l’intervallo selezionato di celle invece dell’intera lunghezza fino a HTML. Per questo, API fornisce ilHtmlSaveOptions.ExportPrintAreaOnly proprietà. Impostando questa proprietà suVero esporterà solo l’area di stampa.

Il codice di esempio seguente illustra l’utilizzo diHtmlSaveOptions.ExportPrintAreaOnlyproprietà per esportare solo l’area di stampa a 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)