This closes #1269, made the `NewStreamWriter` function case insensitive to worksheet name

Co-authored-by: xiangyz <xiangyz@dustess.com>
This commit is contained in:
Eagle Xiang 2022-07-06 20:39:10 +08:00 committed by GitHub
parent d74adcbb15
commit 1dbed64f10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -376,7 +376,7 @@ func (f *File) GetSheetName(index int) (name string) {
// integer type value -1.
func (f *File) getSheetID(name string) int {
for sheetID, sheet := range f.GetSheetMap() {
if sheet == trimSheetName(name) {
if strings.EqualFold(sheet, trimSheetName(name)) {
return sheetID
}
}

View File

@ -465,6 +465,13 @@ func TestDeleteAndAdjustDefinedNames(t *testing.T) {
deleteAndAdjustDefinedNames(&xlsxWorkbook{}, 0)
}
func TestGetSheetID(t *testing.T) {
file := NewFile()
file.NewSheet("Sheet1")
id := file.getSheetID("sheet1")
assert.NotEqual(t, -1, id)
}
func BenchmarkNewSheet(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {