在保存为HTML时启用CSS自定义属性
Contents
[
Hide
]
可能的使用场景
将Excel文件保存为HTML时,如果存在多个基于base64的图片,并且使用了自定义属性,图片数据只需保存一次,从而可以提高生成的HTML性能。保存为HTML时,请使用 HtmlSaveOptions.EnableCssCustomProperties 属性并将其设置为true。
在保存为HTML时启用CSS自定义属性
以下示例代码展示了 HtmlSaveOptions.EnableCssCustomProperties 属性的用法。截图显示了未设置为 true 时该属性的效果。请下载此代码所用的示例Excel文件 和生成的输出HTML 作为参考。
示例代码
This file contains hidden or 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-.NET | |
//Load sample workbook | |
Workbook wb = new Workbook(sourceDir + "sampleEnableCssCustomProperties.xlsx"); | |
HtmlSaveOptions opts = new HtmlSaveOptions(); | |
opts.ExportImagesAsBase64 = true; | |
//Enable EnableCssCustomProperties | |
opts.EnableCssCustomProperties = true; | |
//Save the workbook in html | |
wb.Save(outputDir + "outputEnableCssCustomProperties.html", opts); |