Change the HTML Link Target Type
Contents
[
Hide
]
Aspose.Cells 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.LinkTargetType 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.LinkTargetType property. It changes the link target type to blank. By default, it is the parent.
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-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
string inputPath = dataDir + "Sample1.xlsx"; | |
string outputPath = dataDir + "Output.out.html"; | |
Workbook workbook = new Workbook(dataDir + "Sample1.xlsx"); | |
HtmlSaveOptions opts = new HtmlSaveOptions(); | |
opts.LinkTargetType = HtmlLinkTargetType.Self; | |
workbook.Save(outputPath, opts); | |
Console.WriteLine("File saved: {0}", outputPath); |