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

Compatible issue with go1.21.0 xlsx文件无法用Excel打开 #1608

Closed
yyMlv opened this issue Aug 14, 2023 · 1 comment
Closed

Compatible issue with go1.21.0 xlsx文件无法用Excel打开 #1608

yyMlv opened this issue Aug 14, 2023 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@yyMlv
Copy link

yyMlv commented Aug 14, 2023

Description
使用Create spreadsheet示例生成的xlsx文件在Excel中报错,测试后发现 /Book1.xlsx/xl/worksheets/sheet1.xml 中 导致Excel打开失败。

package main

import (
"fmt"

"github.com/xuri/excelize/v2"

)

func main() {
f := excelize.NewFile()
defer func() {
if err := f.Close(); err != nil {
fmt.Println(err)
}
}()
// Create a new sheet.
index, err := f.NewSheet("Sheet2")
if err != nil {
fmt.Println(err)
return
}
// Set value of a cell.
f.SetCellValue("Sheet2", "A2", "Hello world.")
f.SetCellValue("Sheet1", "B2", 100)
// Set active sheet of the workbook.
f.SetActiveSheet(index)
// Save spreadsheet by the given path.
if err := f.SaveAs("Book1.xlsx"); err != nil {
fmt.Println(err)
}
}
截屏2023-08-14 17 08 38

Output of go version:

go version go1.21.0 darwin/amd64

Excelize version or commit ID:

v2.7.1

Environment details (OS, Microsoft Excel™ version, physical, etc.):
MacOS 13.5 (22G74)
Microsoft Excel for Mac 16.75.2(23071901)

@xuri
Copy link
Member

xuri commented Aug 14, 2023

This issue is duplicated with #1465, #1595 and #1603. Also reference golang/go#61881.

@xuri xuri closed this as completed Aug 14, 2023
@xuri xuri added the duplicate This issue or pull request already exists label Aug 14, 2023
@xuri xuri changed the title xlsx文件无法用Excel打开 Compatible issue with go1.21.0 xlsx文件无法用Excel打开 Aug 14, 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

2 participants