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

Save() corrupts the already existing excel file #1693

Closed
nagxsan opened this issue Oct 18, 2023 · 7 comments
Closed

Save() corrupts the already existing excel file #1693

nagxsan opened this issue Oct 18, 2023 · 7 comments
Labels
duplicate This issue or pull request already exists

Comments

@nagxsan
Copy link

nagxsan commented Oct 18, 2023

Description
I have a Go program that reads an Excel file and needs to make some changes in the same. However when I am trying to save the file using the Save() function, then it corrupts the file. I have error-handled it and it doesn't seem to throw up any error. However, when I reopen the file after the program stops, it shows up an error (screenshot below). Also my file is closed throughout the execution of the program. Can anyone please help me with this issue?

Steps to reproduce the issue:

  1. Have an Excel file and a Golang program that makes some changes in the file using excelize
  2. After those changes, execute Save() method in the code.
  3. Open the Excel file and it shows the error

Describe the results you received:
image

Describe the results you expected:

Output of go version:

(paste your output here)

Excelize version or commit ID:

(paste here)

Environment details (OS, Microsoft Excel™ version, physical, etc.):

@xuri
Copy link
Member

xuri commented Oct 18, 2023

Thanks for your issue. Which version of the Go language and Excelize library are you using? Could you follow the issue template and show us a complete, standalone example program or reproducible demo?

@xuri xuri added the needs more info This issue can't reproduce, need more info label Oct 18, 2023
@ticmark
Copy link

ticmark commented Oct 19, 2023

从2.6.1到2.8全都有这种情况,其他版本暂时没有用到
go version:1.21/1.21.3
OS:Windows,linux

@xuri
Copy link
Member

xuri commented Oct 19, 2023

Hi @ticmark, there are some incompatible changes in the Go 1.21.0 encoding/xml library, and it has been fixed on Go 1.21.1. Please using the Go 1.20.7 and previous Go released version or upgrade to Go 1.21.1 and later. If it doesn't works on Go 1.21.3, please show us a complete, standalone example program or reproducible demo.

@bgetsug
Copy link

bgetsug commented Oct 19, 2023

I am experiencing the same error when running Go 1.21.3 on macOS with Excelize 2.8.0. Reverting to 2.6.0 resolves the issue for me.

Here is a link to my test code: https://github.com/bgetsug/excelize_test

And here is a video demonstrating the issue: https://www.loom.com/share/68a8ae87d2ef4a1e8c931ba5b5169994?sid=f03fc2e4-8b8f-456f-b8e8-4af71096788b

@xuri
Copy link
Member

xuri commented Oct 19, 2023

Hi @daredevil0905, @ticmark, @bgetsug, please try to upgrade the master branch code. This issue similar with #1653, and has been fixed, this patch will be released in the next version.

@nagxsan
Copy link
Author

nagxsan commented Oct 20, 2023

Upgrading the Golang version worked for me., thanks a lot @xuri !

@xuri
Copy link
Member

xuri commented Oct 20, 2023

Thanks for the feedback, I've closed this.

@xuri xuri closed this as completed Oct 20, 2023
@xuri xuri added duplicate This issue or pull request already exists and removed needs more info This issue can't reproduce, need more info labels Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants