Skip to content

Commit 109d8ad

Browse files
committed
Fix missing oneCellAnchor element after add picture in some cases.
1 parent 1e340ae commit 109d8ad

File tree

4 files changed

+37
-45
lines changed

4 files changed

+37
-45
lines changed

picture.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,20 @@ func (f *File) addDrawing(sheet, drawingXML, cell, file string, width, height, r
212212
decodeWsDr := decodeWsDr{}
213213
xml.Unmarshal([]byte(f.readXML(drawingXML)), &decodeWsDr)
214214
cNvPrID = len(decodeWsDr.TwoCellAnchor) + 1
215+
for _, v := range decodeWsDr.OneCellAnchor {
216+
content.WsDr.OneCellAnchor = append(content.WsDr.OneCellAnchor, &xlsxCellAnchor{
217+
EditAs: v.EditAs,
218+
GraphicFrame: v.Content,
219+
})
220+
}
215221
for _, v := range decodeWsDr.TwoCellAnchor {
216-
content.WsDr.TwoCellAnchor = append(content.WsDr.TwoCellAnchor, &xlsxTwoCellAnchor{
222+
content.WsDr.TwoCellAnchor = append(content.WsDr.TwoCellAnchor, &xlsxCellAnchor{
217223
EditAs: v.EditAs,
218224
GraphicFrame: v.Content,
219225
})
220226
}
221227
}
222-
twoCellAnchor := xlsxTwoCellAnchor{}
228+
twoCellAnchor := xlsxCellAnchor{}
223229
twoCellAnchor.EditAs = "oneCell"
224230
from := xlsxFrom{}
225231
from.Col = colStart

0 commit comments

Comments
 (0)