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 In a Loop cannot SetCellValue success or occur corrupted #443

Closed
EP-Toushirou opened this issue Jul 24, 2019 · 2 comments
Closed

Save In a Loop cannot SetCellValue success or occur corrupted #443

EP-Toushirou opened this issue Jul 24, 2019 · 2 comments
Labels
confirmed This issue can be reproduced

Comments

@EP-Toushirou
Copy link

Description

func SetValueTest() {
// Open Book1 Excel
f, err := excelize.OpenFile("./Book1.xlsx")
if err != nil {
Println(err)
return
}

for i := 0; i < 10; i++ {
    f.SetCellValue("Sheet1", fmt.Sprint("A", i + 1), i)
    f.Save()
}

}

Excute SetValueTest can reappeare the bug.

Steps to reproduce the issue:
1.Create Book1 excel and write a num on D3
2.Excute SetValueTest
3.You can see A3 is empty
QQ图片20190724175838

if I save after loop, the problem does not exit

for i := 0; i < 10; i++ {
f.SetCellValue("Sheet1", fmt.Sprint("A", i + 1), i)
}

f.Save()

Output of go version:
go1.12.7.windows-amd64

Excelize version or commit ID:
2.0.1 & update to (2019.07.22)

Environment details (OS, Microsoft Excel™ version, physical, etc.):
win10 1903
office 2019 1906

@xuri xuri added confirmed This issue can be reproduced in progress Working in progress labels Jul 25, 2019
@xuri xuri closed this as completed in 53e653f Jul 26, 2019
xuri added a commit that referenced this issue Jul 26, 2019
@xuri xuri removed the in progress Working in progress label Jul 26, 2019
@xuri
Copy link
Member

xuri commented Jul 26, 2019

Hi @GZLHZ, thanks for your feedback. This issue has been fixed. Please try to upgrade the library with the master branch code, but I don't recommend calling the Save() method in the iteration, which will cause more heap memory allocated.

@EP-Toushirou
Copy link
Author

Hi @GZLHZ, thanks for your feedback. This issue has been fixed. Please try to upgrade the library with the master branch code, but I don't recommend calling the Save() method in the iteration, which will cause more heap memory allocated.

Ok, Thank you. I know that is not a good save way ,I just try it when I learning how to use and report to you.😁 Excelize is a very good project, thank you for create this

nullfy pushed a commit to nullfy/excelize that referenced this issue Oct 23, 2020
nullfy pushed a commit to nullfy/excelize that referenced this issue Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed This issue can be reproduced
Projects
None yet
Development

No branches or pull requests

2 participants