File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1414
1515from openpyxl import Workbook
1616from openpyxl .cell import WriteOnlyCell , Cell
17- from openpyxl .styles import Font
17+ from openpyxl .styles import Font , Fill
1818from openpyxl .utils import get_column_letter
1919from openpyxl .worksheet ._write_only import WriteOnlyWorksheet
2020from 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
You can’t perform that action at this time.
0 commit comments