-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 corrupted after save() #413
Comments
facing same problem |
Hi @valasek , thanks for your issue. I have fixed it. Please try to upgrade the library with the master branch code. @029vaibhav I'm not sure the problem you're having is caused by the same cause, please provides code and file attachment if you can. |
Hi @xuri I confirm that create new Sheet and writing new cells using the code above is fixed now. Tested using v2 branch.
Thenk you for fix and your time! |
I am experiencing the same issue (I think). I have some very simple code that appears to create a corrupted Excel file: package main
import (
"github.com/360EntSecGroup-Skylar/excelize"
"fmt"
)
func main() {
name := "example"
f := excelize.NewFile()
sheetIndex := f.NewSheet(name) // new excel sheet
f.SetActiveSheet(sheetIndex)
// delete original sheet
f.DeleteSheet(f.GetSheetName(f.GetSheetIndex("Sheet1")))
// write some data to spreadsheet
for i := 1; i < 10; i++ {
for j := 1; j < 10; j++ {
coord, err := excelize.CoordinatesToCellName(i,j)
if err != nil {
fmt.Println("Trouble getting coordinates:", err)
}
f.SetCellInt(name, coord, i + j)
}
f.SaveAs("test.xlsx")
}
} Here are screenshots of what happens when I try to open the file with Microsoft Excel: Here is the log file it gives me. Is there something wrong with my code? Or anything I can do to help get this fixed? The output file seems to be correct in Excel but I don't want my clients to have to click through those error messages. Thanks in advance!! |
Hi @wrycode, thanks for your issue. I will fix it recently. FYI: If you just want to change the default workbook name, you can use |
Hi @wrycode, I have fixed it. Please try to upgrade the library with the master branch code. |
@xuri thanks for both the tip and the fix! The issue is gone. Thank you very much! |
Thank you for your great work on excelize. Reading works like a charm. But I have an issue with writing.
When I update a Cell or Add a new Sheet, excel file is corrupted.
Used code:
I shared a source excel directly with xuri.
go env
The text was updated successfully, but these errors were encountered: