We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Description
When you delete a sheet then create a new one and then delete again there is an out of index error
Steps to reproduce the issue:
func main() { xlsx := excelize.NewFile() // Create a new sheet. xlsx.NewSheet("Sheet2") xlsx.NewSheet("Sheet3") xlsx.NewSheet("Sheet4") fmt.Println("init ", xlsx.GetSheetMap()) xlsx.DeleteSheet("Sheet3") fmt.Println("delete ", xlsx.GetSheetMap()) xlsx.NewSheet("Sheet5") fmt.Println("new ", xlsx.GetSheetMap()) xlsx.DeleteSheet("Sheet5") fmt.Println("delete ", xlsx.GetSheetMap()) err := xlsx.SaveAs("./Book1.xlsx") if err != nil { fmt.Println(err) } }
Describe the results you received:
$ go run main.go init map[1:Sheet1 2:Sheet2 3:Sheet3 4:Sheet4] delete map[1:Sheet1 2:Sheet2 4:Sheet4] new map[1:Sheet1 2:Sheet2 4:Sheet5] panic: runtime error: slice bounds out of range goroutine 1 [running]: github.com/360EntSecGroup-Skylar/excelize.(*File).deleteSheetFromContentTypes(0xc0002a2000, 0xc00005cde0, 0x15) C:/Users/xx/go/pkg/mod/github.com/360!ent!sec!group-!skylar/[email protected]/sheet.go:439 +0x2cd github.com/360EntSecGroup-Skylar/excelize.(*File).DeleteSheet(0xc0002a2000, 0x6a15ea, 0x6) C:/Users/xx/go/pkg/mod/github.com/360!ent!sec!group-!skylar/[email protected]/sheet.go:408 +0x45b main.main() C:/data/main.go:25 +0x275 exit status 2
Describe the results you expected: To not have an error Output of go version:
go version
go version go1.11.1 windows/amd64
The text was updated successfully, but these errors were encountered:
e728ff1
Hi @ogimenezb, thanks for your issue. I have fixed it. Please try to upgrade the library to the last version.
Sorry, something went wrong.
Hi @xuri, thanks for your quick fix.
Just tested the latest version and works perfectly!
Fixes qax-os#308, refactor NewSheet(), DeleteSheet(), `SetActiveS…
NewSheet()
DeleteSheet()
bbb70f9
…heet()` and `GetActiveSheetIndex()`
No branches or pull requests
Description
When you delete a sheet then create a new one and then delete again there is an out of index error
Steps to reproduce the issue:
Describe the results you received:
Describe the results you expected:
To not have an error
Output of
go version
:The text was updated successfully, but these errors were encountered: