Convert Excel to HTML with headings
Contents
[
Hide
]
Convert Excel to HTML with headings
Aspose.Cells provides the option to export row and column headings while converting Excel to HTML. This can be achieved by using HtmlSaveOptions.ExportHeadings property provided by the API. The default value of HtmlSaveOptions.ExportHeadings is False. Pass True as the parameter to render headings in the output HTML file. The following image shows the output file generated by the following code.
The following sample code demonstrates using the HtmlSaveOptions.ExportHeadings property to render headings in the output HTML file.
Sample Code
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) |