将Excel文件导出为HTML时从右向左扩展文本
Contents
[
Hide
]
Aspose.Cells for Python via .NET 现支持在导出Excel为HTML时从右到左展开文本。此功能自 v8.9.0.0 版本起实现。如果源Excel文件中包含任何从右到左展开的文本,则Aspose.Cells将能正确导出为HTML。
在将Excel文件导出为HTML时,将文本从右向左扩展
下面的示例代码将sample excel file转换成HTML。这张截图展示了示例 Excel 在 Microsoft Excel 2013 中的样子。
这张截图展示了使用较旧版本生成的output HTML。
这张截图展示了使用更新版本生成的output HTML。
正如您在屏幕截图中所看到的,新版本正确地将右对齐的文本向左扩展,就像Microsoft Excel一样。
This file contains hidden or 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
from aspose.cells import CellsHelper, SaveFormat, Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Load source excel file inside the workbook object | |
wb = Workbook(dataDir + "sample.xlsx") | |
# Save workbook in html format | |
wb.save(dataDir + "ExpandTextFromRightToLeft_out_" + CellsHelper.get_version() + ".html", SaveFormat.HTML) |