openxml Insert image into an inline "inline shape" in word documents Open the document and add imagePart object to reference the picture you want to insert into the shape


Now open the document using OpenXML, you must add an imagePart that references the picture object to the MainDocumentPart object by using a file stream, and get the ID of the image

    string temp;
MainDocumentPart mainPart = document.MainDocumentPart;
                               ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Bmp);

                               using (FileStream stream = new FileStream(barcodepath, FileMode.Open))

                               temp = mainPart.GetIdOfPart(imagePart);