Compatibility of safe_openpyxl with openpyxl==3.1.3

This commit is contained in:
Raphael Michel
2024-06-10 17:19:29 +02:00
parent dd6ebd7a48
commit 39caadb335

View File

@@ -72,9 +72,13 @@ def remove_invalid_excel_chars(val):
return val
def SafeCell(*args, value=None, **kwargs):
def SafeCell(worksheet, row=None, column=None, value=None, **kwargs):
value = remove_invalid_excel_chars(value)
c = Cell(*args, value=value, **kwargs)
if not column:
column = 1
if not row:
row = 1
c = Cell(worksheet, row=row, column=column, value=value, **kwargs)
if c.data_type == TYPE_FORMULA:
c.data_type = TYPE_STRING
return c