TableExport
TableExport copied to clipboard
Wrong values when exporting as XLSX
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
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.
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>
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 I think what I did was to override the formatting because the "try to format as date" is aggressive
@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
what does the class tableexport-string target mean? Are there documents?
@huanghui1 Check out the source: https://github.com/clarketm/TableExport/blob/7e42dda491ee04b7ecb0be79c03b85f19fcf080d/src/stable/js/tableexport.js#L326-L348
I've been working this for few hours to solve it on Chrome. So far no issue on Firefox. Simply add
tableexport-string targetas class selector.Example
<td class="tableexport-string target">Nokia 15280</td>
this solved