Skip to content

Commit 91e8f66

Browse files
committed
Add optional property fill to FormattedCell.
1 parent b0d593b commit 91e8f66

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

aa_py_openpyxl_util/_write_only.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from openpyxl import Workbook
1616
from openpyxl.cell import WriteOnlyCell, Cell
17-
from openpyxl.styles import Font
17+
from openpyxl.styles import Font, Fill
1818
from openpyxl.utils import get_column_letter
1919
from openpyxl.worksheet._write_only import WriteOnlyWorksheet
2020
from openpyxl.worksheet.formula import ArrayFormula
@@ -65,6 +65,11 @@ class FormattedCell:
6565
See https://foss.heptapod.net/openpyxl/openpyxl/-/issues/1898
6666
"""
6767

68+
fill: Optional[Fill] = None
69+
"""
70+
The cell's fill (background). Optional.
71+
"""
72+
6873
def check(self) -> FormattedCell:
6974
"""
7075
Check a cell for potential errors before writing it to a sheet.
@@ -125,6 +130,10 @@ def create_openpyxl_cell(
125130
# noinspection PyUnresolvedReferences,PyDunderSlots
126131
cell.font = self.font
127132

133+
if self.fill:
134+
# noinspection PyUnresolvedReferences,PyDunderSlots
135+
cell.fill = self.fill
136+
128137
return cell
129138

130139

0 commit comments

Comments
 (0)