Commit 630d6bf6 authored by CharlieC's avatar CharlieC
Browse files

Create copies of hyperlinks when working with ranges

Resolves #1502

--HG--
branch : 3.0
parent 3b8c78939a77
# Copyright (c) 2010-2020 openpyxl
"""Reader for a single worksheet."""
import traceback
from copy import copy
from warnings import warn
# compatibility imports
......@@ -384,7 +384,7 @@ class WorksheetReader(object):
for row in self.ws[link.ref]:
for cell in row:
try:
cell.hyperlink = link
cell.hyperlink = copy(link)
except AttributeError:
pass
else:
......
......@@ -49,7 +49,6 @@ class HyperlinkList(Serialisable):
return bool(self.hyperlink)
def __len__(self):
return len(self.hyperlink)
......
......@@ -865,6 +865,7 @@ class TestWorksheetReader:
reader.bind_hyperlinks()
assert ws['B4'].hyperlink.location == "'STP nn000TL-10, PKG 2.52'!A1"
assert ws['B4'].hyperlink.ref == "B4"
def test_merged_hyperlinks(self, PrimedWorksheetReader):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment