Change the HTML Link Target Type
Aspose.Cells for Python via NET allows you to change the HTML link target type. HTML link looks like this
<a href="http://www.aspose.com/" target="_self">
As you can see the target attribute in the above HTML link is _self. You can control this target attribute using the HtmlSaveOptions.link_target_type property. This property takes the HtmlLinkTargetType enum which has the following values.
- HtmlLinkTargetType.BLANK
- HtmlLinkTargetType.PARENT
- HtmlLinkTargetType.SELF
- HtmlLinkTargetType.TOP
The following code illustrates the usage of HtmlSaveOptions.link_target_type property. It changes the link target type to BLANK. By default, it is the PARENT.
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) |