This closes #1017, fix duplicate image caused by incorrect internal relationships ID calculation

This commit is contained in:
xuri 2021-09-10 23:19:59 +08:00
parent dad8f490cc
commit 52609ba526
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7
1 changed files with 4 additions and 8 deletions

View File

@ -253,24 +253,20 @@ func (f *File) addSheetPicture(sheet string, rID int) {
// countDrawings provides a function to get drawing files count storage in the
// folder xl/drawings.
func (f *File) countDrawings() int {
c1, c2 := 0, 0
func (f *File) countDrawings() (count int) {
f.Pkg.Range(func(k, v interface{}) bool {
if strings.Contains(k.(string), "xl/drawings/drawing") {
c1++
count++
}
return true
})
f.Drawings.Range(func(rel, value interface{}) bool {
if strings.Contains(rel.(string), "xl/drawings/drawing") {
c2++
count++
}
return true
})
if c1 < c2 {
return c2
}
return c1
return
}
// addDrawingPicture provides a function to add picture by given sheet,