openxml Insert image into an inline "inline shape" in word documents Get a reference of a Blip object


Example

In office OpenXML, a picture that is inserted into a word document is considered a "Blip" Object or element. The class is derived from the DocumentFormat.OpenXml.Drawing the Blip must have an Embed value that is an imagePart ID. The Blip object then goes inside a BlipFill Object/element, and that also goes inside a graphicData Object/element and that in turn goes into a graphic object element. I'm pretty sure by now you've realized everything works like an XML tree. Sample Open XML tree below.

<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
                       <a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
                         <wps:wsp>
                           <wps:cNvSpPr>
                             <a:spLocks noChangeArrowheads="1" />
                           </wps:cNvSpPr>
                           <wps:spPr bwMode="auto">
                             <a:xfrm>
                               <a:off x="0" y="0" />
                               <a:ext cx="1234440" cy="1234440" />
                             </a:xfrm>
                             <a:prstGeom prst="roundRect">
                               <a:avLst>
                                 <a:gd name="adj" fmla="val 16667" />
                               </a:avLst>
                             </a:prstGeom>
                             <a:blipFill dpi="0" rotWithShape="1">
                               <a:blip r:embed="Raade88ffea8d4c1b" />
                               <a:stretch>
                                 <a:fillRect l="10000" t="10000" r="10000" b="10000" />
                               </a:stretch>
                             </a:blipFill>
                           </wps:spPr>
                           <wps:bodyPr rot="0" vert="horz" wrap="square" lIns="91440" tIns="45720" rIns="91440" bIns="45720" anchor="t" anchorCtr="0" upright="1">
                             <a:noAutofit />
                           </wps:bodyPr>
                         </wps:wsp>
                       </a:graphicData>
                     </a:graphic>