Download an xlsx file with reactJS: Excel can not open file

前端 未结 1 462
闹比i
闹比i 2021-01-27 21:51

I\'m trying to download an xlsx file with reactJS but i\'m receiving this message when i try to open my file after download:

\"Excel can not open file \'file.xlsx\' beca

相关标签:
1条回答
  • 2021-01-27 22:42

    guys!

    The problem was: my binary data was being converted for string by javascript and this was breaking my excel file. i solved my problem converting my binary data on backend to text and then on frontend i make the inverse. The following links helped me:

    java convert inputStream to base64 string

    Creating a Blob from a base64 string in JavaScript

    Thank you for everyone that tried to help. I hope my question can help others

    0 讨论(0)
提交回复
热议问题