导出Excel文件为HTML时导出注释
Contents
[
Hide
]
可能的使用场景
当您将Excel文件保存为HTML时,注释不会被导出。但是,Aspose.Cells提供了**HtmlSaveOptions.IsExportComments**属性来支持此功能。如果将其设置为**true**,则HTML也将显示Excel文件中的注释。
导出Excel文件为HTML时导出注释
以下示例代码说明了**HtmlSaveOptions.IsExportComments**属性的用法。当将属性设置为**true**时,截图显示了代码对HTML的影响。请下载sample Excel file和生成的HTML(50528269)以供参考。
示例代码
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 sample Excel file | |
Workbook wb = new Workbook(srcDir + "sampleExportCommentsHTML.xlsx"); | |
// Export comments - set IsExportComments property to true | |
HtmlSaveOptions opts = new HtmlSaveOptions(); | |
opts.setExportComments(true); | |
// Save the Excel file to HTML | |
wb.save(outDir + "outputExportCommentsHTML.html", opts); |