Modifier le type de cible de lien HTML
Contents
[
Hide
]
Aspose.Cells vous permet de modifier le type de cible de lien HTML. Le lien HTML ressemble à ceci
<a href="http://www.aspose.com/" target="_self">
Comme vous pouvez le voir, l’attribut cible dans le lien HTML ci-dessus est _self. Vous pouvez contrôler cet attribut cible à l’aide de la propriété HtmlSaveOptions.LinkTargetType. Cette propriété prend l’énumération HtmlLinkTargetType qui a les valeurs suivantes.
- HtmlLinkTargetType.Blank
- HtmlLinkTargetType.Parent
- HtmlLinkTargetType.Self
- HtmlLinkTargetType.Top
Le code suivant illustre l’utilisation deHtmlSaveOptions.LinkTargetType la propriété. Il change le type de cible du lien enVide. Par défaut, c’est leparent.
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); |