diff options
| author | xuri <xuri.me@gmail.com> | 2018-07-17 15:28:22 +0800 |
|---|---|---|
| committer | xuri <xuri.me@gmail.com> | 2018-07-17 15:28:22 +0800 |
| commit | a3571ee39bec82d15d9a183aed7f7db39e0a160f (patch) | |
| tree | 92e5961496640d711006768f71542dae93ab89ea /sheet.go | |
| parent | 79dfe1c3070b3c4af14a40acaa5bd8cb477acd3e (diff) | |
Bugfix: create worksheet cause file issue. Relate issue #249.
Diffstat (limited to 'sheet.go')
| -rw-r--r-- | sheet.go | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -132,9 +132,17 @@ func (f *File) setSheet(index int, name string) { // allowed in sheet title. func (f *File) setWorkbook(name string, rid int) { content := f.workbookReader() + rID := 0 + for _, v := range content.Sheets.Sheet { + t, _ := strconv.Atoi(v.SheetID) + if t > rID { + rID = t + } + } + rID++ content.Sheets.Sheet = append(content.Sheets.Sheet, xlsxSheet{ Name: trimSheetName(name), - SheetID: strconv.Itoa(rid), + SheetID: strconv.Itoa(rID), ID: "rId" + strconv.Itoa(rid), }) } |
