Changer le type de lien HTML cible
Aspose.Cells pour Python via NET vous permet de changer le type de cible des liens 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 en utilisant la propriété HtmlSaveOptions.link_target_type. 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 de la propriété HtmlSaveOptions.link_target_type. Il modifie le type de cible du lien en BLANK. Par défaut, c’est le 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) |