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

pull/2/head
xuri 3 years ago
parent dad8f490cc
commit 52609ba526
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7

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

Loading…
Cancel
Save