将Excel中的文档、工作簿和工作表属性导出为HTML

可能的使用场景

当使用 Microsoft Excel 或 Aspose.Cells 将 Microsoft Excel 文件导出为 HTML 时,还会导出各种类型的文档、工作簿和工作表属性,如下面的截图所示。您可以通过将 HtmlSaveOptions.export_document_propertiesHtmlSaveOptions.export_workbook_propertiesHtmlSaveOptions.export_worksheet_properties 设置为 false 来避免导出这些属性。这些属性的默认值是 true。下面的截图展示了导出的 HTML 中这些属性的样子。

todo:image_alt_text

将Excel中的文档、工作簿和工作表属性导出为HTML

下面的示例代码加载了sample Excel file并将其转换为 HTML,并且在output HTML中不导出文档、工作簿和工作表属性。

示例代码

from aspose.cells import HtmlSaveOptions, Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# Load the sample Excel file
workbook = Workbook("sampleExportDocumentWorkbookAndWorksheetPropertiesInHTML.xlsx")
# Specify Html Save Options
options = HtmlSaveOptions()
# We do not want to export document, workbook and worksheet properties
options.export_document_properties = False
options.export_workbook_properties = False
options.export_worksheet_properties = False
# Export the Excel file to Html with Html Save Options
workbook.save("outputExportDocumentWorkbookAndWorksheetPropertiesInHTML.html", options)