restore date formatting at the right place

This commit is contained in:
Jean-Marie Place 2021-10-17 20:20:31 +02:00
parent 29ec51c001
commit d69a6c283f

View File

@ -303,15 +303,6 @@ class ScoExcelSheet:
# création de la cellule
cell = WriteOnlyCell(self.ws, value)
# test datatype to overwrite datetime format
if isinstance(value, datetime.date):
cell.data_type = "d"
cell.number_format = FORMAT_DATE_DDMMYY
elif isinstance(value, int) or isinstance(value, float):
cell.data_type = "n"
else:
cell.data_type = "s"
# recopie des styles
if style is None:
style = self.default_style
@ -335,6 +326,15 @@ class ScoExcelSheet:
cell.comment.width = 7 * max([len(line) for line in lines])
cell.comment.height = 20 * len(lines)
# test datatype to overwrite datetime format
if isinstance(value, datetime.date):
cell.data_type = "d"
cell.number_format = FORMAT_DATE_DDMMYY
elif isinstance(value, int) or isinstance(value, float):
cell.data_type = "n"
else:
cell.data_type = "s"
return cell
def make_row(self, values: list, style=None, comments=None):