Merge pull request 'restore date formatting at the right place' (#171) from jmplace/ScoDoc-Lille:oops_miss_date_export into master

Reviewed-on: https://scodoc.org/git/viennet/ScoDoc/pulls/171
This commit is contained in:
Emmanuel Viennet 2021-10-17 22:04:51 +02:00
commit 565055b4e5

View File

@ -303,15 +303,6 @@ class ScoExcelSheet:
# création de la cellule # création de la cellule
cell = WriteOnlyCell(self.ws, value) 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 # recopie des styles
if style is None: if style is None:
style = self.default_style style = self.default_style
@ -335,6 +326,15 @@ class ScoExcelSheet:
cell.comment.width = 7 * max([len(line) for line in lines]) cell.comment.width = 7 * max([len(line) for line in lines])
cell.comment.height = 20 * len(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 return cell
def make_row(self, values: list, style=None, comments=None): def make_row(self, values: list, style=None, comments=None):