Skip to content
This repository has been archived by the owner on Jul 25, 2021. It is now read-only.

Data exported should be different than the td text #48

Closed
alejcas opened this issue Feb 15, 2017 · 3 comments
Closed

Data exported should be different than the td text #48

alejcas opened this issue Feb 15, 2017 · 3 comments

Comments

@alejcas
Copy link

alejcas commented Feb 15, 2017

Hi, I'have found that the data exported is in fact the td contents and there's no way to tell the table export that the value to be exported should be another (for example a data-value attribute on each td with a fall-back to the td's text)

I'm formatting the numbers with the Spanish format (dots are thousand separators and commas are decimal separators).

So, when exporting to excel, the values are not recognized as numbers.

What I would like to do is add the value to a data attribute on each td and that value goes to excel instead of the td text.

such as:
<td data-value="1526.56">1.526,56</td>

Btw this should be very usefull in many other scenarios.

Any help on this?

@clarketm
Copy link
Owner

clarketm commented Apr 28, 2017

I know @danielgregorywilson has made some contributions and PRs that address the type (e.g. exporting an actual number) portion of your request. I need to circle back with him before I can get you any feedback of this, but assuming the functionality exists in js-xlsx and we can get this synced up with the alpha release, which is supposed to supersede the v3.x.x jQuery-coupled implementation. I think we can get this fixed relatively quickly.

@clarketm
Copy link
Owner

clarketm commented May 6, 2017

@janscas - the cell-types and type overrides portion of your issue "formatting the numbers ... not recognized as numbers" is fixed (or rather, it has been added with the help of @danielgregorywilson) as of the latest release v4.0.0.

Cell-value replacement with an attribute is not. Although with this latest release, direct access to the locally stored data is now available, meaning that you can create your own formatting and data modification. This is a robust way to do any preprocessing you would like with the data before calling your own custom export trigger(s) (using export2file). Here is an example of this feature taken from the docs.

screen shot 2017-05-05 at 7 53 34 pm

@clarketm clarketm closed this as completed May 6, 2017
@alejcas
Copy link
Author

alejcas commented May 6, 2017

Thanks a lot. With this I can solve my problem.
And is usefull in many other ways.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants