不支持的边框样式的Excel转为HTML
Contents
[
Hide
]
不支持的边框样式的Excel转为HTML
Microsoft Excel支持一些虚线边框类型,这些边框不受Web浏览器支持。当使用Aspose.Cells将此类文件转换为HTML时,这些边框将被移除。但是,Aspose.Cells for Python via Java支持使用HtmlSaveOptions.ExportSimilarBorderStyle属性显示类似的边框。您可以将HtmlSaveOptions.ExportSimilarBorderStyle属性的值设置为True以导出不支持的边框。
以下示例代码加载了包含一些不支持边框的示例Excel文件,并在下图中显示了HtmlSaveOptions.ExportSimilarBorderStyle属性在输出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 + "sampleExportSimilarBorderStyle.xlsx") | |
# Initialize HtmlSaveOptions | |
saveOptions = HtmlSaveOptions() | |
saveOptions.setExportSimilarBorderStyle(True) | |
# Save the excel file. | |
workbook.save(output_directory + "outputExportSimilarBorderStyle.html", saveOptions) |