-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
Description
When using StreamWriter on an existing sheet created by an excel software the saved workbook is corrupted.
Writing rows or not in the StreamWriter doesn't matter, only StreamWriter.Flush corrupt the workbook.
If the the Workbook was created by Excelize the Sheet will have all it's anterior content overwritten but the Workbook won't be corrupted.
Steps to reproduce the issue:
- Create a workbook with an empty sheet on excel (tried google sheet as well), create "Sheet1" if not already there, save it.
package main
import "github.com/360EntSecGroup-Skylar/excelize/v2"
func main() {
f, err := excelize.OpenFile("Workbook.xlsx")
if err != nil {
panic(err)
}
sw, err := f.NewStreamWriter("Sheet1")
if err != nil {
panic(err)
}
if err := sw.Flush(); err != nil {
panic(err)
}
if err := f.SaveAs("Workbook2.xlsx"); err != nil {
panic(err)
}
}- Open the Workbook2.xlsx in excel
Describe the results you received:
The opened workbook in empty and corrupted
Describe the results you expected:
A functional Workbook that kept his content. Or an error.
Output of go version:
go version go1.13.3 linux/amd64
Excelize version or commit ID:
2.1.0
Metadata
Metadata
Assignees
Labels
No labels