Получение гиперссылок в диапазоне
Contents
[
Hide
]
Получение гиперссылок в диапазоне
Класс Range предоставляет свойство hyperlinks, которое возвращает все гиперссылки в выбранном диапазоне. Вы также можете удалить гиперссылку, вызвав метод Hyperlink.delete.
This file contains hidden or 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
from aspose.cells import 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. | |
sourceDir = RunExamples.GetDataDir(".") | |
# Output directory | |
outputDir = RunExamples.Get_OutputDirectory() | |
# Instantiate a Workbook object | |
# Open an Excel file | |
workbook = Workbook(sourceDir + "HyperlinksSample.xlsx") | |
# Get the first (default) worksheet | |
worksheet = workbook.worksheets[0] | |
# Create a range A2:B3 | |
range = worksheet.cells.create_range("A2", "B3") | |
# Get Hyperlinks in range | |
hyperlinks = range.hyperlinks | |
for link in hyperlinks: | |
print(str(str(link.area) + " : " ) + link.address) | |
# To delete the link, use the Hyperlink.Delete() method. | |
link.delete() | |
workbook.save(outputDir + "HyperlinksSample_out.xlsx") |