Skip to content

word picture add

zmworm edited this page Apr 29, 2026 · 52 revisions

Word: Picture - add

Add an inline or floating image to the document.

Parent: /body or /body/p[N]

Properties

Property Default Description
path/src (required) Image source: local file path, data:image/png;base64,... data URI, or https://... HTTP URL
width 6in Width (EMU or units: cm, in, pt, px)
height 4in Height
alt - Alt text (also declared in schema)
anchor false Floating (vs inline)
wrap - none, square, tight, through, topAndBottom, behind, inFront
hPosition, vPosition - Position (EMU)
hRelative - margin, page, column
vRelative - margin, page, paragraph
behindText false Floating image appears behind text
fallback 1×1 transparent PNG Raster fallback image for SVG (used by older Office versions)

Examples

# Add inline image
officecli add report.docx /body --type picture --prop src=chart.png --prop width=5in --prop height=3in --prop alt="Sales Chart"

# Add floating image
officecli add report.docx /body --type picture --prop src=logo.png --prop anchor=true --prop wrap=square --prop width=2in --prop height=1in

# Add image from base64 data URI
officecli add report.docx /body --type picture --prop "path=data:image/png;base64,iVBORw0KGgo..." --prop width=4in --prop height=3in

# Add image from HTTP URL
officecli add report.docx /body --type picture --prop src=https://example.com/chart.png --prop width=5in --prop height=3in

# Add SVG image (dual representation: SVG + PNG fallback)
officecli add report.docx /body --type picture --prop src=diagram.svg --prop width=6in --prop height=4in

# Add SVG with custom raster fallback for older Office versions
officecli add report.docx /body --type picture --prop src=icon.svg --prop fallback=icon.png --prop width=2in --prop height=2in

Note: Supported image formats: png, jpg, gif, bmp, tiff, emf, wmf, svg. HTTP URLs have a 30s timeout. SVG images use OOXML dual representation: modern Office (2016+) renders the SVG; older versions fall back to a PNG (auto-generated 1×1 transparent pixel unless fallback is specified).


Based on OfficeCLI v1.0.64

Clone this wiki locally