Skip to content

Commit

Permalink
This closes qax-os#1269, made the NewStreamWriter function case ins…
Browse files Browse the repository at this point in the history
…ensitive to worksheet name

Co-authored-by: xiangyz <xiangyz@dustess.com>
  • Loading branch information
eaglexiang and xiangyz authored Jul 6, 2022
1 parent 03c4d5f commit 48c8d64
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
7 changes: 7 additions & 0 deletions sheet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 48c8d64

Please sign in to comment.