PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Excel export date format
Excel export date format
Débuté par Arie Mars, 29 oct. 2010 16:40 - 3 réponses
Posté le 29 octobre 2010 - 16:40
When I export the data in a tablecontrol to Excel, all date columns are formatted as "custom" instead of "date". This way, sorting such a column in Excel does not work as expected.
Is there a way to get real date columns in Excel, without al lot of programming, which would make development 10 times slower :-) ?
Posté le 06 novembre 2010 - 02:05
Hello Arie,
Because Windev return a date like this: "YYYYMMJJ"
In this case, you have only two solutions:
1) After fill the Excel document, you open it and modify the column in a good format.
2) By program:
LOCAL
MyXlsDocument is a xlsDocument
MyXlsDocument = XlsOpen("c:\Excel\Doc.xls")
// If the second Column is a date format:
IF MyXlsDocument -1 THEN
MyXlsDocument..Column[2]..Type = xlsTypeDate
END
Best regards,
Jean-Yves
Posté le 19 novembre 2010 - 07:55
I have a similar problem. When I try to use the code that was suggested I get the error message ".." operator forbidden. It occurs on the "Type" property of my column[3]. What have I done wrong?
My Code Follows ----------------------
ResDir is string
MyXlsDocument is a xlsDocument
ResDir = SysDir(srDesktop)
ResDir = ResDir + "\ExportedFSMH.XLS"
TableToExcel(WIN_Export.Table_qCollectedData,ResDir,taWithLayout)
MyXlsDocument = xlsOpen(ResDir)
IF MyXlsDocument -1 THEN
MyXlsDocument..Column[3]..Type = xlsTypeDate
MyXlsDocument..Column[5]..Type = xlsTypeDate
END
Thanks
Steve
Posté le 04 octobre 2021 - 17:22
Je reviens sur la demande consistant à mettre à jour en écriture (lors d'un export de données vers Excel) le format de la cellule au format date, par exemple, pour forcer le type de cellule.
Apparemment La propriété Type étant en lecture seule, une telle mise à jour n'est pas possible, mais qualeq'un a-t-il une solution?
Merci à tous