TableExport icon indicating copy to clipboard operation
TableExport copied to clipboard

Wrong values when exporting as XLSX

Open douglasdtc opened this issue 7 years ago • 8 comments

Hello,

When exporting data to XLSX (or XLS), some values are exported wrong. In our case, we have a value of 276,5, and it's exported as Date and a value of -593031.

When exporting on Firefox, it works as expected, it looks like this issue is related to Chrome only.

Below is an example with our data, the problem ocurrs on line 13.

Thank you.

https://codepen.io/anon/pen/MVpNor

douglasdtc avatar Mar 21 '18 14:03 douglasdtc

I just noticed a similar situation. We have a table with date field in mmm/yyyy format, localized. If it was exported as string, no problem there. But it gets exported as date format dd/mm/yy and sometimes it gets the wrong information, like "Fev/2018" (pt-BR for February) exporting as 01/01/2018. This seems to affect only dates in localized format where they differ from en-US, because "Mar/2018" (pt-BR Março, en-US March, but first 3 letters are the same) exports correctly to 01/03/2018.

joaociocca avatar Mar 26 '18 21:03 joaociocca

I've been working this for few hours to solve it on Chrome. So far no issue on Firefox. Simply add tableexport-string target as class selector.

Example <td class="tableexport-string target">Nokia 15280</td>

Swordeflux avatar Apr 12 '18 04:04 Swordeflux

I've been experiencing something similar. I have several columns that have dollar values. Some of those values are exporting as you would expect, but other format as a date (e.g. $7.31 exports as 7/31/01).

mcsmithers avatar Oct 16 '18 23:10 mcsmithers

@mcsmithers I think what I did was to override the formatting because the "try to format as date" is aggressive

nowherenearithaca avatar Oct 17 '18 00:10 nowherenearithaca

@mcsmithers fyi - here is info on having a custom format function - the repo owner suggested modifying the prototype of TableExport on use, while my initial fix was to change the source to allow passing a format function

https://github.com/clarketm/TableExport/issues/147#issuecomment-432538591

nowherenearithaca avatar Oct 24 '18 19:10 nowherenearithaca

what does the class tableexport-string target mean? Are there documents?

huanghui1 avatar Apr 25 '19 07:04 huanghui1

@huanghui1 Check out the source: https://github.com/clarketm/TableExport/blob/7e42dda491ee04b7ecb0be79c03b85f19fcf080d/src/stable/js/tableexport.js#L326-L348

hvaughan3 avatar May 30 '19 13:05 hvaughan3

I've been working this for few hours to solve it on Chrome. So far no issue on Firefox. Simply add tableexport-string target as class selector.

Example <td class="tableexport-string target">Nokia 15280</td>

this solved

phbrazil avatar Jul 11 '19 21:07 phbrazil