更改 HTML 链接目标类型
Contents
[
Hide
]
Aspose.Cells 允许您更改 HTML 链接目标类型。 HTML 链接如下所示:
<a href="http://www.aspose.com/" target="_self">
可以看到上面HTML链接中的target属性是**_self**。您可以使用 HtmlSaveOptions.setLinkTargetType() 属性控制此目标属性。此属性采用具有以下值的 HtmlLinkTargetType 枚举。
更改 HTML 链接目标类型
下面的代码说明了使用HtmlSaveOptions.setLinkTargetType() 方法财产。它将链接目标类型更改为空白的.默认情况下,它是父母.你可以获得源文件但是,通过此链接,您可以使用其中包含 HTML 超链接的任何 Excel 文件来运行此代码。
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
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(ChangeHTMLLinkTargetType.class); | |
Workbook workbook = new Workbook(dataDir + "source.xlsx"); | |
HtmlSaveOptions opts = new HtmlSaveOptions(); | |
opts.setLinkTargetType(HtmlLinkTargetType.SELF); | |
workbook.save(dataDir + "out.html", opts); |