تغيير نوع الوجهة للرابط HTML
تتيح Aspose.Cells for Python via NET لك تغيير نوع الوجهة لرابط HTML. يبدو رابط HTML مثل هذا
<a href="http://www.aspose.com/" target="_self">
كما ترون، فإن سمة الوجهة في الرابط HTML أعلاه هي _self. يمكنك التحكم في هذه سمة الوجهة باستخدام ال HtmlSaveOptions.link_target_type. تأخذ هذه الخاصية ال HtmlLinkTargetType الذي يحتوي على القيم التالية.
- HtmlLinkTargetType.BLANK
- HtmlLinkTargetType.PARENT
- HtmlLinkTargetType.SELF
- HtmlLinkTargetType.TOP
يوضح الكود التالي استخدام الخاصية HtmlSaveOptions.link_target_type. يقوم بتغيير نوع الوجهة للرابط إلى BLANK. بشكل افتراضي، يكون النوع الأصلي 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) |