From e7581ebf3e14f096b6e2d56ed34d381b4af6d310 Mon Sep 17 00:00:00 2001 From: xuri Date: Wed, 23 Oct 2019 10:08:29 +0800 Subject: [PATCH] Fix corrupted Excel file issue #413 --- sheet.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sheet.go b/sheet.go index 951baf9..9e8d504 100644 --- a/sheet.go +++ b/sheet.go @@ -406,6 +406,11 @@ func (f *File) DeleteSheet(name string) { f.SheetCount-- } } + for idx, bookView := range wb.BookViews.WorkBookView { + if bookView.ActiveTab >= f.SheetCount { + wb.BookViews.WorkBookView[idx].ActiveTab-- + } + } f.SetActiveSheet(len(f.GetSheetMap())) }