1from openpyxl.descriptors.serialisable import Serialisable
2from openpyxl.descriptors import (
3 String,
4 Sequence,
5)
6from openpyxl.descriptors.excel import Relation
7
8
9class Hyperlink(Serialisable):
10
11 tagname = "hyperlink"
12
13 ref = String()
14 location = String(allow_none=True)
15 tooltip = String(allow_none=True)
16 display = String(allow_none=True)
17 id = Relation()
18 target = String(allow_none=True)
19
20 __attrs__ = ("ref", "location", "tooltip", "display", "id")
21
22 def __init__(self,
23 ref=None,
24 location=None,
25 tooltip=None,
26 display=None,
27 id=None,
28 target=None,
29 ):
30 self.ref = ref
31 self.location = location
32 self.tooltip = tooltip
33 self.display = display
34 self.id = id
35 self.target = target
36
37
38class HyperlinkList(Serialisable):
39
40 tagname = "hyperlinks"
41
42 __expected_type = Hyperlink
43 hyperlink = Sequence(expected_type=__expected_type)
44
45 def __init__(self, hyperlink=()):
46 self.hyperlink = hyperlink