openxml Insert image into an inline "inline shape" in word documents With a collection reference of all the shapes, loop through the collection.


Example

Now that you have a collection of all the shape references in the document. Loop through the collection with a foreach, and through each iteration create a Blip object. Set the Blip object embed value to the picture ID reference you captured earlier from the image part. Also create a Stretch object, and FillRectangle object(these are not really necessary, they are just used them for proper alignment of the image). And append each to its parent object like the XML tree equivalent.

foreach (DocumentFormat.OpenXml.Office2010.Word.DrawingShape.WordprocessingShape sp in shapes2)
                              {
                                  //Wps.ShapeProperties shapeProperties1 = 
                                  A.BlipFill blipFill1 = new A.BlipFill() { Dpi = (UInt32Value)0U, RotateWithShape = true };
                                  A.Blip blip1 = new A.Blip() { Embed = temp };

                                  A.Stretch stretch1 = new A.Stretch();
                                  A.FillRectangle fillRectangle1 = new A.FillRectangle() { Left = 10000, Top = 10000, Right = 10000, Bottom = 10000 };
                                  Wps.WordprocessingShape wordprocessingShape1 = new Wps.WordprocessingShape();



                                      stretch1.Append(fillRectangle1);
                                      blipFill1.Append(blip1);
                                      blipFill1.Append(stretch1);
                                      Wps.ShapeProperties shapeProperties1 = sp.Descendants<Wps.ShapeProperties>().First();
                                      shapeProperties1.Append(blipFill1);
                                      
                              }