获取范围内的超链接
Contents
[
Hide
]
获取范围内的超链接
要获得范围内的超链接,请使用获取超链接()的财产范围班级。这获取超链接()属性获取选定范围内的所有超链接。
以下代码片段显示了如何获取选定范围内的所有超链接。
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
source_directory = "Examples/SampleFiles/SourceDirectory/" | |
# Load Source Excel file | |
workbook = Workbook(source_directory + "HyperlinksSample.xlsx") | |
# Access first worksheet | |
worksheet = workbook.getWorksheets().get(0) | |
# Create a range A2:B3 | |
range = worksheet.getCells().createRange("A2", "B3") | |
# Get Hyperlinks in range | |
hyperlinks = range.getHyperlinks() | |
for link in hyperlinks: | |
print(str(link.getArea()) + " : " + str(link.getAddress())) |