summaryrefslogtreecommitdiff
path: root/picture.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2022-11-29 00:03:49 +0800
committerxuri <xuri.me@gmail.com>2022-11-29 00:03:49 +0800
commitc0713951c8d95fba3a23da39bfb5c85d858d2338 (patch)
treecfdd5efc253e8072206f563954f010ce31773ba7 /picture.go
parentdde6b9c00135cefffdd9c64b7f22cfdc34c28e47 (diff)
This closes #1404, fixes the insert picture problem in some cases
- Updates unit tests - Updates documentation for stream mode functions - Updates hyperlinks in the documentation
Diffstat (limited to 'picture.go')
-rw-r--r--picture.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/picture.go b/picture.go
index 4e8a652..b4629b0 100644
--- a/picture.go
+++ b/picture.go
@@ -250,20 +250,24 @@ func (f *File) addSheetPicture(sheet string, rID int) error {
// countDrawings provides a function to get drawing files count storage in the
// folder xl/drawings.
-func (f *File) countDrawings() (count int) {
+func (f *File) countDrawings() int {
+ var c1, c2 int
f.Pkg.Range(func(k, v interface{}) bool {
if strings.Contains(k.(string), "xl/drawings/drawing") {
- count++
+ c1++
}
return true
})
f.Drawings.Range(func(rel, value interface{}) bool {
if strings.Contains(rel.(string), "xl/drawings/drawing") {
- count++
+ c2++
}
return true
})
- return
+ if c1 < c2 {
+ return c2
+ }
+ return c1
}
// addDrawingPicture provides a function to add picture by given sheet,