Skip to content
This repository has been archived by the owner on May 29, 2018. It is now read-only.

Exporting to Excel gives an error when opening the file #117

Open
oyvindwh opened this issue Jan 25, 2017 · 6 comments
Open

Exporting to Excel gives an error when opening the file #117

oyvindwh opened this issue Jan 25, 2017 · 6 comments

Comments

@oyvindwh
Copy link

When downloading to excel from the module, I get an error when opening the file. If I choose to accept the content of the file is correct. Can I change/update the script to remove the error message?

2017-01-25_16-13-26

@TorsteinHonsi
Copy link
Contributor

If I remember correctly we haven't found a way to work around this issue. The contents of the file is a HTML table, but Excel interprets it correctly nonetheless.

@BonsaiCode
Copy link

Its quite involved to generate real Excel data. It would probably be best to integrate with a 3rd party javascript lib, e.g. https://www.travismclarke.com/tableexport/ (that's just one I found from google) Not sure how difficult it would be to integrate.

@TorsteinHonsi
Copy link
Contributor

Here's a proof of concept of using TableExport: http://jsfiddle.net/highcharts/hr7jLwda/

Does the produced Excel file look good to you?

If this is working, we can consider providing a hook for it in the export-csv plugin (which will soon become an integrated Highcharts module). We can plug it into our own file download functionality so we won't depend on FileSaver.js.

@BonsaiCode
Copy link

I'm still getting the error, BUT I am using a newer version of Excel which is looking for xlsx type. it should work for older versions of Excel that are expecting xls.

I have updated the example here for xlsx: http://jsfiddle.net/ahdavis/hr7jLwda/3/
I added the xlsx.core.js include at the top and changed the format to xlsx on line 9. However, highcharts is still sending an extension of xls instead of xlsx. I think if this could be changed, then it would work for xlsx, and then you would need an additional Download XLSX option.

@TorsteinHonsi
Copy link
Contributor

Thanks for contributing - the path to core.xlsx.js was wrong, but once fixing that, the extension also became correct. I added a separate menu item for XLSX: http://jsfiddle.net/highcharts/hr7jLwda/

@BonsaiCode
Copy link

Great, xlsx works for me now! Thank you!

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

No branches or pull requests

3 participants