summaryrefslogtreecommitdiff
path: root/sheet.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-12-03 00:19:11 +0800
committerxuri <xuri.me@gmail.com>2021-12-03 00:19:11 +0800
commit577a07f08c6121d627323db00fdf9e74989a5515 (patch)
treee8252f418b2ac632d148d272aaeac2a81000d08c /sheet.go
parentaa359f1c748b5cbdc57ae032255e8b8940001e0b (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.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/sheet.go b/sheet.go
index 6244e02..99ae1a2 100644
--- a/sheet.go
+++ b/sheet.go
@@ -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 {