更改HTML链接的目标类型
Contents
[
Hide
]
Aspose.Cells for Python via NET允许您更改HTML链接的目标类型。HTML链接如下所示
<a href="http://www.aspose.com/" target="_self">
如您所见,上述HTML链接中的target属性是**_self**。您可以使用HtmlSaveOptions.link_target_type属性来控制此target属性。此属性采用了HtmlLinkTargetType枚举,其具有以下值。
- HtmlLinkTargetType.BLANK
- HtmlLinkTargetType.PARENT
- HtmlLinkTargetType.SELF
- HtmlLinkTargetType.TOP
以下代码说明了HtmlSaveOptions.link_target_type属性的用法。它将链接目标类型更改为BLANK。默认情况下为PARENT。
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 HtmlLinkTargetType, HtmlSaveOptions, 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(".") | |
inputPath = dataDir + "Sample1.xlsx" | |
outputPath = dataDir + "Output.out.html" | |
workbook = Workbook(dataDir + "Sample1.xlsx") | |
opts = HtmlSaveOptions() | |
opts.link_target_type = HtmlLinkTargetType.SELF | |
workbook.save(outputPath, opts) | |
print("File saved: {0}", outputPath) |