From d69a6c283f7cf4fbbe3b05e555845abeddfa82e1 Mon Sep 17 00:00:00 2001 From: Place Jean-Marie Date: Sun, 17 Oct 2021 20:20:31 +0200 Subject: [PATCH] restore date formatting at the right place --- app/scodoc/sco_excel.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/scodoc/sco_excel.py b/app/scodoc/sco_excel.py index 586b48b7..77fe375d 100644 --- a/app/scodoc/sco_excel.py +++ b/app/scodoc/sco_excel.py @@ -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):