This closes #1269, made the `NewStreamWriter` function case insensitive to worksheet name
Co-authored-by: xiangyz <xiangyz@dustess.com>
This commit is contained in:
parent
d74adcbb15
commit
1dbed64f10
2
sheet.go
2
sheet.go
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue