Skip to content

Commit 336a43b

Browse files
committed
Upgrade the Excelize library version
- Add Transparency field in the Fill data type - Add argument data type checking for set_cell_hyperlink function
1 parent 02f3211 commit 336a43b

File tree

7 files changed

+39
-21
lines changed

7 files changed

+39
-21
lines changed

excelize.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4217,6 +4217,20 @@ def set_cell_hyperlink(
42174217
f.set_cell_hyperlink("Sheet1", "A3", "Sheet1!A40", "Location")
42184218
```
42194219
"""
4220+
prepare_args(
4221+
(
4222+
[sheet, cell, link, link_type, opts[0]]
4223+
if opts
4224+
else [sheet, cell, link, link_type]
4225+
),
4226+
[
4227+
argsRule("sheet", [str]),
4228+
argsRule("cell", [str]),
4229+
argsRule("link", [str]),
4230+
argsRule("link_type", [str]),
4231+
argsRule("opts", [HyperlinkOpts], True),
4232+
],
4233+
)
42204234
err, lib.SetCellHyperLink.restype = None, c_char_p
42214235
options = (
42224236
byref(py_value_to_c(opts[0], types_go._HyperlinkOpts()))

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ module github.com/xuri/excelize-py
33
go 1.23.0
44

55
require (
6-
github.com/xuri/excelize/v2 v2.9.2-0.20250710001508-249b593d21b1
7-
golang.org/x/image v0.29.0
6+
github.com/xuri/excelize/v2 v2.9.2-0.20250809060300-b372bd3d2e71
7+
golang.org/x/image v0.30.0
88
)
99

1010
require (
@@ -13,7 +13,7 @@ require (
1313
github.com/tiendc/go-deepcopy v1.6.1 // indirect
1414
github.com/xuri/efp v0.0.1 // indirect
1515
github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9 // indirect
16-
golang.org/x/crypto v0.40.0 // indirect
17-
golang.org/x/net v0.42.0 // indirect
18-
golang.org/x/text v0.27.0 // indirect
16+
golang.org/x/crypto v0.41.0 // indirect
17+
golang.org/x/net v0.43.0 // indirect
18+
golang.org/x/text v0.28.0 // indirect
1919
)

go.sum

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ github.com/tiendc/go-deepcopy v1.6.1 h1:uVRTItFeNHkMcLueHS7OCsxgxT9P8MzGB/taUa2Y
1313
github.com/tiendc/go-deepcopy v1.6.1/go.mod h1:toXoeQoUqXOOS/X4sKuiAoSk6elIdqc0pN7MTgOOo2I=
1414
github.com/xuri/efp v0.0.1 h1:fws5Rv3myXyYni8uwj2qKjVaRP30PdjeYe2Y6FDsCL8=
1515
github.com/xuri/efp v0.0.1/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
16-
github.com/xuri/excelize/v2 v2.9.2-0.20250710001508-249b593d21b1 h1:wj8xnLX7FjRxN+ua4A+UEB0IzTQwlN6zTQ1atbUgQRM=
17-
github.com/xuri/excelize/v2 v2.9.2-0.20250710001508-249b593d21b1/go.mod h1:isQygQdjiU88/HpJYtp+6TN/FH29HvVjWT8vFk3t5+w=
16+
github.com/xuri/excelize/v2 v2.9.2-0.20250809060300-b372bd3d2e71 h1:aE3CI3bJsGABxX6whWhUg1kX82rU+kSR+JQR4TbM16A=
17+
github.com/xuri/excelize/v2 v2.9.2-0.20250809060300-b372bd3d2e71/go.mod h1:kJNWyr0LiVxr4LZiOJiN9w8t177/VpVsR4GIXvgzoAc=
1818
github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9 h1:+C0TIdyyYmzadGaL/HBLbf3WdLgC29pgyhTjAT/0nuE=
1919
github.com/xuri/nfp v0.0.2-0.20250530014748-2ddeb826f9a9/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
20-
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM=
21-
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY=
22-
golang.org/x/image v0.29.0 h1:HcdsyR4Gsuys/Axh0rDEmlBmB68rW1U9BUdB3UVHsas=
23-
golang.org/x/image v0.29.0/go.mod h1:RVJROnf3SLK8d26OW91j4FrIHGbsJ8QnbEocVTOWQDA=
24-
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
25-
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
26-
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
27-
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
20+
golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
21+
golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
22+
golang.org/x/image v0.30.0 h1:jD5RhkmVAnjqaCUXfbGBrn3lpxbknfN9w2UhHHU+5B4=
23+
golang.org/x/image v0.30.0/go.mod h1:SAEUTxCCMWSrJcCy/4HwavEsfZZJlYxeHLc6tTiAe/c=
24+
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
25+
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
26+
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
27+
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
2828
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2929
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

test_excelize.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,13 +1764,14 @@ def test_cell_hyperlink(self):
17641764
)
17651765
)
17661766
with self.assertRaises(RuntimeError) as context:
1767-
f.set_cell_hyperlink(
1768-
"SheetN",
1769-
"A3",
1770-
display,
1771-
"External",
1772-
)
1767+
f.set_cell_hyperlink("SheetN", "A3", display, "External")
17731768
self.assertEqual(str(context.exception), "sheet SheetN does not exist")
1769+
with self.assertRaises(TypeError) as context:
1770+
f.set_cell_hyperlink("Sheet1", "A3", display, "External", 1)
1771+
self.assertEqual(
1772+
str(context.exception),
1773+
"expected type HyperlinkOpts for argument 'opts', but got int",
1774+
)
17741775
# Set underline and font color style for the cell.
17751776
style = f.new_style(
17761777
excelize.Style(font=excelize.Font(color="1265BE", underline="single"))

types_c.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ struct Fill
140140
int ColorLen;
141141
char **Color;
142142
int Shading;
143+
int Transparency;
143144
};
144145

145146
// Font directly maps the font settings of the fonts.

types_go.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class _Fill(Structure):
112112
("ColorLen", c_int),
113113
("Color", POINTER(POINTER(c_char))),
114114
("Shading", c_int),
115+
("Transparency", c_int),
115116
]
116117

117118

types_py.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ class Fill:
285285
pattern: int = 0
286286
color: Optional[List[str]] = None
287287
shading: int = 0
288+
transparency: int = 0
288289

289290

290291
@dataclass

0 commit comments

Comments
 (0)