From 109d8adae3f5ca5a24905c6b2581ae8c42095d51 Mon Sep 17 00:00:00 2001 From: Ri Xu Date: Wed, 1 Mar 2017 11:00:42 +0800 Subject: Fix missing `oneCellAnchor` element after add picture in some cases. --- picture.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'picture.go') diff --git a/picture.go b/picture.go index db4448b..54d820e 100644 --- a/picture.go +++ b/picture.go @@ -212,14 +212,20 @@ func (f *File) addDrawing(sheet, drawingXML, cell, file string, width, height, r decodeWsDr := decodeWsDr{} xml.Unmarshal([]byte(f.readXML(drawingXML)), &decodeWsDr) cNvPrID = len(decodeWsDr.TwoCellAnchor) + 1 + for _, v := range decodeWsDr.OneCellAnchor { + content.WsDr.OneCellAnchor = append(content.WsDr.OneCellAnchor, &xlsxCellAnchor{ + EditAs: v.EditAs, + GraphicFrame: v.Content, + }) + } for _, v := range decodeWsDr.TwoCellAnchor { - content.WsDr.TwoCellAnchor = append(content.WsDr.TwoCellAnchor, &xlsxTwoCellAnchor{ + content.WsDr.TwoCellAnchor = append(content.WsDr.TwoCellAnchor, &xlsxCellAnchor{ EditAs: v.EditAs, GraphicFrame: v.Content, }) } } - twoCellAnchor := xlsxTwoCellAnchor{} + twoCellAnchor := xlsxCellAnchor{} twoCellAnchor.EditAs = "oneCell" from := xlsxFrom{} from.Col = colStart -- cgit v1.2.1