将 Excel 转换为带有工具提示的 HTML
Contents
[
Hide
]
将 Excel 转换为带有工具提示的 HTML
在生成的 HTML 中可能会出现文本被截断的情况,您可能希望在悬停事件中将完整文本显示为工具提示。Aspose.Cells 通过提供 HtmlSaveOptions.AddTooltipText 属性来支持此功能。设置 HtmlSaveOptions.AddTooltipText 属性为 true 将在生成的 HTML 中添加完整文本作为工具提示。
以下图片显示了生成的 HTML 文件中的工具提示。
以下代码样本加载了source excel file并生成了带有工具提示的output HTML file。
示例代码
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 | |
//directories | |
String sourceDir = Utils.Get_SourceDirectory(); | |
String outputDir = Utils.Get_OutputDirectory(); | |
// Open the template file | |
Workbook workbook = new Workbook(sourceDir + "AddTooltipToHtmlSample.xlsx"); | |
HtmlSaveOptions options = new HtmlSaveOptions(); | |
options.setAddTooltipText(true); | |
// Save as Markdown | |
workbook.save(outputDir + "AddTooltipToHtmlSample_out.html", options); |