识别自闭标签

Contents
[ ]

HTML 可以为空标签设置多种标签格式,例如 <td></td>要么 <td/>Aspose.Cells 支持这两种格式。可以通过将附加的示例 HTML 文件转换为 Excel 文件来测试此功能。示例 HTML 文件和输出文件可以从以下链接下载进行测试。

源文件

输出文件

source_directory = "Examples/SampleFiles/SourceDirectory/"
output_directory = "Examples/SampleFiles/OutputDirectory/"
loadOptions = HtmlLoadOptions(LoadFormat.HTML)
# Load the Sample Workbook
workbook = Workbook(source_directory + "sampleSelfClosingTags.html", loadOptions)
# Save the excel file.
workbook.save(output_directory + "sampleSelfClosingTags_out.xlsx")