w:drawing (Inline or Floating Drawing)
Container that embeds a DrawingML inline (wp:inline) or floating (wp:anchor) drawing object within a run.
Parent elements
Description
w:drawing is an inline container that embeds a DrawingML graphic (image, chart, SmartArt, shape) within a run. It is defined in ECMA-376 Part 1 §17.3.3.9.
w:drawing contains either a wp:inline element (for inline-with-text positioning) or a wp:anchor element (for floating positioning) from the wordprocessingDrawing namespace (xmlns:wp). The actual image or graphic data is referenced inside via a:graphic / pic:pic elements from the DrawingML namespace.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
| (none) | — | — | w:drawing has no attributes of its own; all content is expressed through child elements. |
Examples
<w:r>
<w:drawing>
<wp:inline distT="0" distB="0" distL="0" distR="0">
<wp:extent cx="5486400" cy="3200400"/>
<wp:docPr id="1" name="Picture 1"/>
<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<!-- graphic data with image reference -->
</a:graphic>
</wp:inline>
</w:drawing>
</w:r>
// Use ImagePart and AddImagePart, then construct
// Drawing > Inline > Graphic > GraphicData > Picture
// with the relationship ID from the added image part.
Notes
- Dimensions in
wp:extentare in EMUs (English Metric Units): 914400 EMUs = 1 inch. - For floating images, use
wp:anchorinstead ofwp:inline.