将 Excel 转换为带标题的 HTML
Contents
[
Hide
]
将 Excel 转换为带标题的 HTML
Aspose.Cells 提供了在将 Excel 转换为 HTML 时导出行和列标题的选项。这可以通过使用来实现HtmlSaveOptions.ExportHeadingsAPI提供的属性。默认值为HtmlSaveOptions.ExportHeadings是错误的.经过真的作为在输出 HTML 文件中呈现标题的参数。下图显示了以下代码生成的输出文件。
下面的示例代码演示了如何使用HtmlSaveOptions.ExportHeadings属性以在输出 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
# Load the Sample Workbook | |
workbook = Workbook() | |
# Access first worksheet | |
worksheet = workbook.getWorksheets().get(0) | |
# Access cell A1 and put some text inside it. | |
cell = worksheet.getCells().get("A1") | |
cell.putValue("This is some text.") | |
# Get the Normal and Html5 strings. | |
strNormal = cell.getHtmlString(False) | |
strHtml5 = cell.getHtmlString(True) | |
# Print the Normal and Html5 strings | |
print("Normal:\r\n" + strNormal) | |
print("Html5:\r\n" + strHtml5) |