Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open exported xlsx file containing Japanese character #2522

Closed
duchm12 opened this issue Feb 15, 2022 · 17 comments · May be fixed by andrewbrereton/n8n#4, Ahiiia92/CRMapp-angular-frontend#22 or zhousheng193/vue-element-admin#5

Comments

@duchm12
Copy link

duchm12 commented Feb 15, 2022

Hi, thanks for this amazing library.

Issue: I am using to SheetJS export array of arrays with each element is a Japanese characters to xlsx file. So far, I have tried with xlsb file working fine but when I tried to export it to xlsx file and open it, excel reports an error in XML parsing. Here are my code:
image

I tried switching array of arrays contains only Latin characters worked, or one row and Latin character and one row Japanese characters also worked. But 2 rows of Japanese characters next to each other make the output file error.

This is the output I wants look like this
image

Hope you could give me some insight, thanks.

@reviewher
Copy link
Contributor

Are you using the latest version? console.log(XLSX.version) when you do the export.

If you are using the latest version (0.18.1) can you share the data or the broken XLSX file?

@duchm12
Copy link
Author

duchm12 commented Feb 15, 2022

Hi,
console.log(XLSX.version) showing that I am using 0.18.1.
Here is the file
90_自社評価・表示_登録用項目 (2).xlsx

@reviewher
Copy link
Contributor

Can you share the broken file? You can click-drag the file into the github issue box ("Attach files by dragging & dropping, selecting or pasting them.")

@duchm12
Copy link
Author

duchm12 commented Feb 15, 2022

When opening the file, I got error like this:
image

For more information, here is my array of arrays object:
image

Since I export the workbook in binary, I use a converter function to convert binary to octet:
image

@reviewher
Copy link
Contributor

The resulting XML looks truncated (sheet1.xml ends with ></). Instead of manually doing all this, can you try forcing a download using writeFile?

XLSX.writeFile(workbook, `${fileName}.xlsx`)

This will create the file (like XLSX.write) and also attempt a download (like you are trying to do with the URL)

@duchm12
Copy link
Author

duchm12 commented Feb 15, 2022

Hi,
I have tested with XLSX.writeFile(workbook, ${fileName}.xlsx), unfortunately, it did not work well for me. When open the output file, I got:
image

@duchm12
Copy link
Author

duchm12 commented Feb 15, 2022

Sorry for my hasty reply, I sent wrong image output above. When opening the file using writeFile. I encountered with:
image

@SheetJSDev
Copy link
Contributor

This is probably the same issue reported in #2521 , but by pure coincidence it did not trigger an invalid file for @lanchengkai . There is a truncation in the utf8 encoding and we'll rush an update.

@duchm12
Copy link
Author

duchm12 commented Feb 15, 2022

Hi,
I tried to look at the output xlsx file as .xml document using zip tool, found that in sheet1.xml missing 3 closing tags as below:
image
I modified (add closing tags to sheet1.xml) and reopened the file output. The file opened without any error. Does this have any relation to how the XLSX.write() works or am I missing any step?

@duchm12
Copy link
Author

duchm12 commented Feb 15, 2022

I'm using Vue 2 framework for my web application, does xlsx.full.min.js install with the xlsx npm package?

@SheetJSDev
Copy link
Contributor

No worries, can you try replacing the dependency with [email protected]?

@duchm12
Copy link
Author

duchm12 commented Feb 15, 2022

Hi,
Thanks for the quick action. The new package [[email protected]](https://www.npmjs.com/package/xlsx-issue2522) works as expected. Is xlsx-issue2552 temporary fix or will you incorporate it in the main xlsx package?

@SheetJSDev
Copy link
Contributor

It will be, just want to be sure we identified the root cause first.

@duchm12
Copy link
Author

duchm12 commented Feb 15, 2022

May I ask when will the next stable release?

@SheetJSDev
Copy link
Contributor

30 minutes-ish

@duchm12
Copy link
Author

duchm12 commented Feb 15, 2022

Glad to hear it. That's all for now. Thanks for your swift and amazing support!

SheetJSDev added a commit that referenced this issue Feb 15, 2022
@SheetJSDev
Copy link
Contributor

The node/deno tests passed (sauce labs grid will refresh momentarily, but it passed IE10/11 and Chrome and iOS Safari tests). The module has been published to npm ([email protected]) and the tag has been pushed, it may take a few minutes for the registry to reload. Please verify, and sincere apologies for the issue in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants