diff --git a/picture.go b/picture.go index 1a9eeeb..1d6b5f0 100644 --- a/picture.go +++ b/picture.go @@ -649,9 +649,7 @@ func (f *File) getPicture(row, col int, drawingXML, drawingRelationships string) if wsDr, _, err = f.drawingParser(drawingXML); err != nil { return } - if pics = f.getPicturesFromWsDr(row, col, drawingRelationships, wsDr); len(pics) > 0 { - return - } + pics = f.getPicturesFromWsDr(row, col, drawingRelationships, wsDr) deWsDr = new(decodeWsDr) if err = f.xmlNewDecoder(bytes.NewReader(namespaceStrictToTransitional(f.readXML(drawingXML)))). Decode(deWsDr); err != nil && err != io.EOF { diff --git a/picture_test.go b/picture_test.go index 7eb21cb..4920634 100644 --- a/picture_test.go +++ b/picture_test.go @@ -70,6 +70,15 @@ func TestAddPicture(t *testing.T) { assert.NoError(t, f.SaveAs(filepath.Join("test", "TestAddPicture1.xlsx"))) assert.NoError(t, f.Close()) + // Test get pictures after inserting a new picture from a workbook which contains existing pictures + f, err = OpenFile(filepath.Join("test", "TestAddPicture1.xlsx")) + assert.NoError(t, err) + assert.NoError(t, f.AddPicture("Sheet1", "A30", filepath.Join("test", "images", "excel.jpg"), nil)) + pics, err := f.GetPictures("Sheet1", "A30") + assert.NoError(t, err) + assert.Len(t, pics, 2) + assert.NoError(t, f.Close()) + // Test add picture with unsupported charset content types f = NewFile() f.ContentTypes = nil