Skip to content

Commit

Permalink
Merge pull request #300 from taomin597715379/bugfix_297
Browse files Browse the repository at this point in the history
resolve #297, fix GetSheetMap() failed
  • Loading branch information
xuri committed Nov 24, 2018
2 parents 507fc53 + 1bb59f7 commit 724ed5f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sheet.go 100644 → 100755
Expand Up @@ -353,8 +353,9 @@ func (f *File) GetSheetMap() map[int]string {
sheetMap := map[int]string{}
for _, v := range content.Sheets.Sheet {
for _, rel := range rels.Relationships {
if rel.ID == v.ID {
rID, _ := strconv.Atoi(strings.TrimSuffix(strings.TrimPrefix(rel.Target, "worksheets/sheet"), ".xml"))
relStr := strings.SplitN(rel.Target, "worksheets/sheet", 2)
if rel.ID == v.ID && len(relStr) == 2 {
rID, _ := strconv.Atoi(strings.TrimSuffix(relStr[1], ".xml"))
sheetMap[rID] = v.Name
}
}
Expand Down

0 comments on commit 724ed5f

Please sign in to comment.