summaryrefslogtreecommitdiff
path: root/excelize.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2020-07-09 01:24:11 +0800
committerxuri <xuri.me@gmail.com>2020-07-09 01:24:11 +0800
commit49257c5918f3aa9f2730021a7e6a24b4835646fd (patch)
tree5b7e0b016bb008fd5680d19b59b05ab722a8d17b /excelize.go
parentf7bd0729c65fc82305328f7ac8fbaf329d1075c0 (diff)
support case-sensitive doc parts to improve compatibility
Diffstat (limited to 'excelize.go')
-rw-r--r--excelize.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/excelize.go b/excelize.go
index 970759c..bac569a 100644
--- a/excelize.go
+++ b/excelize.go
@@ -220,16 +220,25 @@ func checkSheet(xlsx *xlsxWorksheet) {
// addRels provides a function to add relationships by given XML path,
// relationship type, target and target mode.
func (f *File) addRels(relPath, relType, target, targetMode string) int {
+ var uniqPart = map[string]string{
+ SourceRelationshipSharedStrings: "/xl/sharedStrings.xml",
+ }
rels := f.relsReader(relPath)
if rels == nil {
rels = &xlsxRelationships{}
}
var rID int
- for _, rel := range rels.Relationships {
+ for idx, rel := range rels.Relationships {
ID, _ := strconv.Atoi(strings.TrimPrefix(rel.ID, "rId"))
if ID > rID {
rID = ID
}
+ if relType == rel.Type {
+ if partName, ok := uniqPart[rel.Type]; ok {
+ rels.Relationships[idx].Target = partName
+ return rID
+ }
+ }
}
rID++
var ID bytes.Buffer