将Excel中的文档、工作簿和工作表属性导出为HTML
Contents
[
Hide
]
可能的使用场景
当使用Microsoft Excel或Aspose.Cells将Microsoft Excel文件导出为HTML时,也将导出各种类型的文档、工作簿和工作表属性,如下截图所示。您可以通过将 HtmlSaveOptions.ExportDocumentProperties、HtmlSaveOptions.ExportWorkbookProperties 和 HtmlSaveOptions.ExportWorksheetProperties 设为 false 来避免导出这些属性。这些属性的默认值为 true。下面的截图展示了导出的HTML中这些属性的样子。
将Excel中的文档、工作簿和工作表属性导出为HTML
以下示例代码加载了 样本Excel文件 并将其转换为HTML,在 输出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
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
//Load the sample Excel file | |
Workbook workbook = new Workbook("sampleExportDocumentWorkbookAndWorksheetPropertiesInHTML.xlsx"); | |
//Specify Html Save Options | |
HtmlSaveOptions options = new HtmlSaveOptions(); | |
//We do not want to export document, workbook and worksheet properties | |
options.setExportDocumentProperties(false); | |
options.setExportWorkbookProperties(false); | |
options.setExportWorksheetProperties(false); | |
//Export the Excel file to Html with Html Save Options | |
workbook.save("outputExportDocumentWorkbookAndWorksheetPropertiesInHTML.html", options); |