openxml Insert image into an inline "inline shape" in word documents Adding reference of the image the shapes in the template document.


Example

Now you have a reference of the image. Insert the image into the shapes in the template document. To do this, you will have to use some LINQ to iterate through the document and get a reference to all the shapes in the document. The wps:spPr element you see in the above XML code is the xml element for the shapes in a document. The equivalent C# class is WordprocessingShape

IEnumerable<DocumentFormat.OpenXml.Office2010.Word.DrawingShape.WordprocessingShape> shapes2 = document.MainDocumentPart.document.Body.Descendants<DocumentFormat.OpenXml.Office2010.Word.DrawingShape.WordprocessingShape>();