This closes #1628, fix the GetPictures function returns pictures doesn't correct in some cases
This commit is contained in:
parent
db22452398
commit
15614badfc
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue