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

Excel Files generated with Excelize cannot be read correctly #1653

Closed
mediawall opened this issue Sep 7, 2023 · 14 comments
Closed

Excel Files generated with Excelize cannot be read correctly #1653

mediawall opened this issue Sep 7, 2023 · 14 comments
Labels
bug Something isn't working confirmed This issue can be reproduced

Comments

@mediawall
Copy link

reproduce the issue under go 1.21.1 and excelize 2.8.0

test.xlsx

package main

import "github.com/xuri/excelize/v2"

func main() {
	f, err := excelize.OpenFile("test.xlsx")
	if err != nil {
		panic(err)
	}
	defer f.Close()

	if err := f.SaveAs("test1.xlsx"); err != nil {
		panic(err)
	}
}

test.xlsx can open correctly but test1.xlsx can't
Screenshot from 2023-09-07 14-13-21

@gyf19
Copy link

gyf19 commented Sep 7, 2023

+1 go 1.21 版本出问题了

@Achillesxu
Copy link

+1 go 1.21 版本出问题了

@xuri
Copy link
Member

xuri commented Sep 7, 2023

@gyf19 @Achillesxu If it does not work with Go 1.21.0, please reference the issues #1465, #1595, #1603, #1608, #1614, #1619, #1620, #1621, #1623, #1633, #1637, #1641, #1642, #1648, #1651, and #1652. There are some incompatible changes in the Go 1.21.0 encoding/xml library. I have given feedback to the Go team and created a patch for it (golang/go#61881), and Go 1.21.1 is released on wednesday, september 6, this issue has been fixed. Please using the Go 1.20.7 and previous Go released version or upgrade to the Go 1.21.1. I have added notice on the README and documentation website for this, but the Go version was 1.21.1 in @mediawall report, so I need to investigation for this.

@gyf19 @Achillesxu, 如果你正在使用 Go 1.21.0,请参考问题 #1465#1595#1603#1603#1614#1619#1620#1621#1623#1633#1637#1641#1642#1648#1651#1652。Go 1.21.0 对 encoding/xml 标准库做了不兼容的更改,我已将该问题反馈至 Go 团队,并提交了修复补丁 golang/go#61881,已在2023年9月6日发布的 Go 语言 1.21.1 版本中修复。我为此在自述文档文档网站上添加了通知,因此请使用 Go 1.20.7 以及更早版本,或升级至 Go1.21.1,但在 @mediawall 的报告中,使用的 Go 版本为 1.21.1,因此该问题有待进一步调查。

@xuri xuri added bug Something isn't working confirmed This issue can be reproduced in progress Working in progress labels Sep 7, 2023
@xuri xuri closed this as completed in 5e8a020 Sep 7, 2023
@xuri
Copy link
Member

xuri commented Sep 7, 2023

Hi @mediawall, thanks for your issue. I have fixed this issue, please try to upgrade the master branch code, and this patch will be released in the next version.

@xuri xuri removed the in progress Working in progress label Sep 7, 2023
xuri added a commit that referenced this issue Sep 7, 2023
- Correction cell type when formatting date type cell value
- Add check for MID and MIDB formula functions num_chars arguments, prevent panic on specifying a negative number
- Ref #65, add support for 2 formula functions: SEARCH and SEARCHB
- Fix a v2.8.0 regression bug, error on set print area and print titles with built-in special defined name
- Add new exported function `GetPivotTables` for get pivot tables
- Add a new `Name` field in the `PivotTableOptions` to support specify pivot table name
- Using relative cell reference in the pivot table docs and unit tests
- Support adding slicer content type part internally
- Add new exported source relationship and namespace `NameSpaceSpreadSheetXR10`, `ContentTypeSlicer`, `ContentTypeSlicerCache`, and `SourceRelationshipSlicer`
- Add new exported extended URI `ExtURIPivotCacheDefinition`
- Fix formula argument wildcard match issues
- Update GitHub Actions configuration, test on Go 1.21.x with 1.21.1 and later
- Avoid corrupted workbooks generated by improving compatibility with internally indexed color styles
@mediawall
Copy link
Author

Hi @xuri , thanks for the fix. 👍

@Achillesxu
Copy link

Hi @xuri , thanks for the fix. 👍

jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
- Correction cell type when formatting date type cell value
- Add check for MID and MIDB formula functions num_chars arguments, prevent panic on specifying a negative number
- Ref qax-os#65, add support for 2 formula functions: SEARCH and SEARCHB
- Fix a v2.8.0 regression bug, error on set print area and print titles with built-in special defined name
- Add new exported function `GetPivotTables` for get pivot tables
- Add a new `Name` field in the `PivotTableOptions` to support specify pivot table name
- Using relative cell reference in the pivot table docs and unit tests
- Support adding slicer content type part internally
- Add new exported source relationship and namespace `NameSpaceSpreadSheetXR10`, `ContentTypeSlicer`, `ContentTypeSlicerCache`, and `SourceRelationshipSlicer`
- Add new exported extended URI `ExtURIPivotCacheDefinition`
- Fix formula argument wildcard match issues
- Update GitHub Actions configuration, test on Go 1.21.x with 1.21.1 and later
- Avoid corrupted workbooks generated by improving compatibility with internally indexed color styles
@ffh-zhang
Copy link

I use the go 1.20.7, and I had the same problem. MS Excel can not open correctly using excelize 2.8.0, but it works when using excelize 2.3.1

@xuri
Copy link
Member

xuri commented Nov 29, 2023

Hi @ffh-zhang, thanks for your feedback. Please try to upgrade the master branch code at first, if it still doesn't works, please show us a standalone example program or reproducible demo.

@ffh-zhang
Copy link

Hi @ffh-zhang, thanks for your feedback. Please try to upgrade the master branch code at first, if it still doesn't works, please show us a standalone example program or reproducible demo.

test.xlsx
testResult.xlsx

@ffh-zhang
Copy link

Hi @ffh-zhang, thanks for your feedback. Please try to upgrade the master branch code at first, if it still doesn't works, please show us a standalone example program or reproducible demo.

`package main

import (
"fmt"
"github.com/xuri/excelize/v2"
)

func main() {
file, err := excelize.OpenFile("./test.xlsx")
if err != nil {
fmt.Printf("OpenFile error")
}

file.SaveAs("testResult.xlsx")

}`

@xuri
Copy link
Member

xuri commented Nov 29, 2023

Could you provide the file attachment without confidential info?

@LofannyWD1010
Copy link

I got same issue like that, I already update excelize xuri from master branch and still get error like that. I use go version 1.21 @xuri

@xuri
Copy link
Member

xuri commented Dec 7, 2023

Thanks for your feedback. Could you provide the file attachment without confidential info?

@ffh-zhang
Copy link

Could you provide the file attachment without confidential info?

Sorry, I can only reproduce this issue through this type of file with charts. When I use a regular blank file, this problem will not occur. The newly provided file "test.xlsx" only includes some hypothetical example data. I want to know if it is suitable.

test.xlsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed This issue can be reproduced
Projects
None yet
Development

No branches or pull requests

6 participants