تصدير نطاق منطقة الطباعة إلى HTML

تصدير نطاق المنطقة المطبوعة إلى HTML

يدعم Aspose.Cells for Python via Java تصدير نطاق الطباعة فقط أي النطاق المحدد من الخلايا بدلاً من جدول البيانات بأكمله إلى HTML. لهذا، توفر الواجهة برمجة التطبيقات (API) خاصية ExportPrintAreaOnly (https://reference.aspose.com/cells/python/asposecells.api/htmlsaveoptions#ExportPrintAreaOnly). سيؤدي ضبط هذه الخاصية إلى True إلى تصدير نطاق الطباعة فقط.

يقوم الكود النموذجي التالي بتوضيح استخدام خاصية ExportPrintAreaOnly (https://reference.aspose.com/cells/python/asposecells.api/htmlsaveoptions#ExportPrintAreaOnly) لتصدير نطاق الطباعة فقط إلى 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)