Cannot open exported xlsx file containing Japanese character #2522

Closed
opened 2022-02-15 03:27:52 +00:00 by duchm12 · 17 comments
duchm12 commented 2022-02-15 03:27:52 +00:00 (Migrated from github.com)

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.

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](https://user-images.githubusercontent.com/99295405/153986178-50967072-c2c6-4f38-9ac1-a197692061f2.png) 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](https://user-images.githubusercontent.com/99295405/153987173-7aa06eb0-21dd-4261-b89c-1511487b00d3.png) Hope you could give me some insight, thanks.
reviewher commented 2022-02-15 03:34:20 +00:00 (Migrated from github.com)

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?

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 commented 2022-02-15 03:42:49 +00:00 (Migrated from github.com)

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

Hi, `console.log(XLSX.version`) showing that I am using 0.18.1. Here is the file [90_自社評価・表示_登録用項目 (2).xlsx](https://github.com/SheetJS/sheetjs/files/8065618/90_._.2.xlsx)
reviewher commented 2022-02-15 03:45:06 +00:00 (Migrated from github.com)

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.")

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 commented 2022-02-15 03:50:43 +00:00 (Migrated from github.com)

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

When opening the file, I got error like this: ![image](https://user-images.githubusercontent.com/99295405/153989234-df6d8628-28ba-41e8-9f27-75d142bf7a23.png) For more information, here is my array of arrays object: ![image](https://user-images.githubusercontent.com/99295405/153989345-4380f886-3321-4bb1-be30-1815aea10bce.png) Since I export the workbook in binary, I use a converter function to convert binary to octet: ![image](https://user-images.githubusercontent.com/99295405/153989497-1def4e6c-1400-41b8-aad5-6ac5b1f7bbc7.png)
reviewher commented 2022-02-15 03:57:18 +00:00 (Migrated from github.com)

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)

The resulting XML looks truncated (sheet1.xml ends with `></`). Instead of manually doing all this, can you try forcing a download using `writeFile`? ```js 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 commented 2022-02-15 04:10:25 +00:00 (Migrated from github.com)

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

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](https://user-images.githubusercontent.com/99295405/153991148-66443566-f2d0-4740-a5ed-fe36cc8ff434.png)
duchm12 commented 2022-02-15 04:19:20 +00:00 (Migrated from github.com)

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

Sorry for my hasty reply, I sent wrong image output above. When opening the file using `writeFile`. I encountered with: ![image](https://user-images.githubusercontent.com/99295405/153991839-1fe38e6b-30f1-46d4-9076-fc022d4aaf71.png)
SheetJSDev commented 2022-02-15 05:29:09 +00:00 (Migrated from github.com)

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.

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 commented 2022-02-15 05:37:16 +00:00 (Migrated from github.com)

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?

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](https://user-images.githubusercontent.com/99295405/153998838-9406835f-efb4-42e4-a6ec-32fa96c3a1b9.png) 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 commented 2022-02-15 05:42:41 +00:00 (Migrated from github.com)

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

I'm using Vue 2 framework for my web application, does `xlsx.full.min.js` install with the `xlsx` npm package?
SheetJSDev commented 2022-02-15 05:47:33 +00:00 (Migrated from github.com)

No worries, can you try replacing the dependency with xlsx-issue2522@0.18.1?

No worries, can you try replacing the dependency with [`xlsx-issue2522@0.18.1`](https://www.npmjs.com/package/xlsx-issue2522)?
duchm12 commented 2022-02-15 06:20:55 +00:00 (Migrated from github.com)

Hi,
Thanks for the quick action. The new package [xlsx-issue2522@0.18.1](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?

Hi, Thanks for the quick action. The new package `[xlsx-issue2522@0.18.1](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 commented 2022-02-15 06:24:14 +00:00 (Migrated from github.com)

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

It will be, just want to be sure we identified the root cause first.
duchm12 commented 2022-02-15 06:59:01 +00:00 (Migrated from github.com)

May I ask when will the next stable release?

May I ask when will the next stable release?
SheetJSDev commented 2022-02-15 07:10:23 +00:00 (Migrated from github.com)

30 minutes-ish

30 minutes-ish
duchm12 commented 2022-02-15 07:19:26 +00:00 (Migrated from github.com)

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

Glad to hear it. That's all for now. Thanks for your swift and amazing support!
SheetJSDev commented 2022-02-15 07:40:06 +00:00 (Migrated from github.com)

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 (xlsx@0.18.2) 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.

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 (xlsx@0.18.2) 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 in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sheetjs/sheetjs#2522
No description provided.