在将Excel转换为HTML时隐藏叠加内容
Contents
[
Hide
]
在将Excel转换为HTML时隐藏叠加内容
当将Excel文件保存为HTML时,您可以为单元格字符串指定不同的交叉类型。默认情况下,Aspose.Cells根据Microsoft Excel生成HTML,但当您将 HtmlSaveOptions.HtmlCrossStringType 设置为 CROSS_HIDE_RIGHT 时,它将隐藏所有与单元格字符串叠加或重叠的右侧字符串。
下面的示例代码加载了 示例Excel文件,并在将 HtmlSaveOptions.HtmlCrossStringType 设置为 CROSS_HIDE_RIGHT 后将其保存为 输出HTML。截图解释了 CROSS_HIDE_RIGHT 如何影响默认输出的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
source_directory = "Examples/SampleFiles/SourceDirectory/" | |
output_directory = "Examples/SampleFiles/OutputDirectory/" | |
# Load the Sample Workbook | |
workbook = Workbook(source_directory + "sampleHidingOverlaidContentWithCrossHideRightWhileSavingToHtml.xlsx") | |
# Initialize HtmlSaveOptions | |
saveOptions = HtmlSaveOptions() | |
saveOptions.setHtmlCrossStringType(HtmlCrossType.CROSS_HIDE_RIGHT) | |
# Save the excel file. | |
workbook.save(output_directory + "outputHidingOverlaidContentWithCrossHideRightWhileSavingToHtml.html", saveOptions) |