Skip to content

Commit 677a22d

Browse files
committed
resolve qax-os#366 fix image duplication
1 parent 7d197c6 commit 677a22d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

picture.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,21 @@ func (f *File) addSheetPicture(sheet string, rID int) {
250250
// countDrawings provides a function to get drawing files count storage in the
251251
// folder xl/drawings.
252252
func (f *File) countDrawings() int {
253-
count := 0
253+
c1, c2 := 0, 0
254254
for k := range f.XLSX {
255255
if strings.Contains(k, "xl/drawings/drawing") {
256-
count++
256+
c1++
257257
}
258258
}
259-
return count
259+
for rel := range f.Drawings {
260+
if strings.Contains(rel, "xl/drawings/drawing") {
261+
c2++
262+
}
263+
}
264+
if c1 < c2 {
265+
return c2
266+
}
267+
return c1
260268
}
261269

262270
// addDrawingPicture provides a function to add picture by given sheet,

0 commit comments

Comments
 (0)