diff options
author | xuri <xuri.me@gmail.com> | 2021-12-03 00:19:11 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2021-12-03 00:19:11 +0800 |
commit | 577a07f08c6121d627323db00fdf9e74989a5515 (patch) | |
tree | e8252f418b2ac632d148d272aaeac2a81000d08c /sheet.go | |
parent | aa359f1c748b5cbdc57ae032255e8b8940001e0b (diff) |
Simplify code and update unit test
Improve unit test coverage for the functions: `NewStyle`, `SetActiveSheet`, `SearchSheet` and `deleteAndAdjustDefinedNames`
Simplify code and add comments for the function: `deleteAndAdjustDefinedNames`
Diffstat (limited to 'sheet.go')
-rw-r--r-- | sheet.go | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -586,15 +586,12 @@ func (f *File) DeleteSheet(name string) { f.SetActiveSheet(f.GetSheetIndex(activeSheetName)) } +// deleteAndAdjustDefinedNames delete and adjust defined name in the workbook +// by given worksheet ID. func deleteAndAdjustDefinedNames(wb *xlsxWorkbook, deleteLocalSheetID int) { - if wb == nil { + if wb == nil || wb.DefinedNames == nil { return } - - if wb.DefinedNames == nil { - return - } - for idx := 0; idx < len(wb.DefinedNames.DefinedName); idx++ { dn := wb.DefinedNames.DefinedName[idx] if dn.LocalSheetID != nil { |