diff options
author | xuri <xuri.me@gmail.com> | 2022-11-29 00:03:49 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2022-11-29 00:03:49 +0800 |
commit | c0713951c8d95fba3a23da39bfb5c85d858d2338 (patch) | |
tree | cfdd5efc253e8072206f563954f010ce31773ba7 /picture.go | |
parent | dde6b9c00135cefffdd9c64b7f22cfdc34c28e47 (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.go | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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, |