Skip to content

Commit

Permalink
Merge pull request qax-os#448 from Sustainedhhh/master
Browse files Browse the repository at this point in the history
  • Loading branch information
xuri authored Jul 25, 2019
2 parents 080a74c + 6b9517d commit 6774f2c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,12 @@ func (f *File) getSheetMap() map[string]string {
for _, v := range content.Sheets.Sheet {
for _, rel := range rels.Relationships {
if rel.ID == v.ID {
maps[v.Name] = fmt.Sprintf("xl/%s", rel.Target)
// Construct a target XML as xl/worksheets/sheet%d by split path, compatible with different types of relative paths in workbook.xml.rels, for example: worksheets/sheet%d.xml and /xl/worksheets/sheet%d.xml
pathInfo := strings.Split(rel.Target, "/")
pathInfoLen := len(pathInfo)
if pathInfoLen > 0 {
maps[v.Name] = fmt.Sprintf("xl/worksheets/%s", pathInfo[pathInfoLen-1])
}
}
}
}
Expand Down

0 comments on commit 6774f2c

Please sign in to comment.