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

Doesn't work with Go 1.21.0 发现"b.xlsx"中的部分内容有问题。是否让我们尽星尝试恢复?如果您信任此工作簿的源,请单击"是" #1648

Closed
ambiguous-pointer opened this issue Sep 5, 2023 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@ambiguous-pointer
Copy link

ambiguous-pointer commented Sep 5, 2023

我在运行 官方文档中的程序时出现错误 创建Excel文件
Description
我在运行官方文档中的示例程序发现结果如图
image

发现"b.xlsx"中的部分内容有问题。是否让我们尽星尝试恢复?如果您信任此工作簿的源,请单击"是"。
我在搜索已有的Issues 发现类似的问答但似乎 很久之前或者 相关解答不能解决目前问题

以下是我的代码

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("D:\Users\Admin\Desktop\b.xlsx"); err != nil {
        fmt.Println(err)
    }
}

是api有变动没有及时更新吗?我看见在 #1139 中提到会在下一个版本解决问题很明显这个已经是的了
还是说 按照 #1625 中最后所讲 需要修改 修改xml底层类库 ?
希望能够得到详细解答 非常感谢

我的平台和 版本

windows version OS内部版本22621.2134
go version go version go1.21.0 windows/amd64
Microsoft® Excel® 2019MSO (版本 2307 Build 16.0.16626.20170) 32 位

@xuri
Copy link
Member

xuri commented Sep 5, 2023

Thanks for your issue. If you are reporting a new issue, make sure that we do not have any duplicates already exist. If it does not work with Go 1.21.0, please reference the (pinned) issues #1465, #1595, #1603, #1608, #1614, #1619, #1620, #1621, #1623, #1633, #1637, #1641 and #1642. 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 the Go team has added golang/go#62051 to the Go 1.21.1 milestone. I suggest using the Go 1.20.7 and previous Go released version or waiting for the next Go minor releases. I have added notice on the README and documentation website for this, and I've closed this. If you have any questions, please let me know, and reopen this anytime.

谢谢你的反馈,在您创建新的issue之前,请确保不存在任何重复的 issue。请参考(置顶)issue #1465#1595#1603#1603#1614#1619#1620#1621#1623#1633#1637#1641#1642。Go 1.21.0 对 encoding/xml 标准库做了不兼容的更改,我已将该问题反馈至 Go 团队,并提交了修复补丁 golang/go#61881,将在下一个版本 Go 1.21.1 中修复。目前建议使用 Go 1.20.7 以及更早版本,或等待2023年9月6日下一个 Go 语言的次要版本发布。我已经为此在README 和文档网站上添加了通知,因此我将此问题关闭了。如果您有任何问题,请告诉我,并可随时重新打开。

@xuri xuri closed this as not planned Won't fix, can't repro, duplicate, stale Sep 5, 2023
@xuri xuri added the duplicate This issue or pull request already exists label Sep 5, 2023
@xuri xuri changed the title 发现"b.xlsx"中的部分内容有问题。是否让我们尽星尝试恢复?如果您信任此工作簿的源,请单击"是" Doesn't work with Go 1.21.0 发现"b.xlsx"中的部分内容有问题。是否让我们尽星尝试恢复?如果您信任此工作簿的源,请单击"是" Sep 5, 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