Word Insert Image
Word Insert Image
Section titled “Word Insert Image”Type: word-insert-image · Package: Word Activities v1.0.4
Inserts an image into the document as its own paragraph. Useful to include a logo, a signature, a chart or a screenshot in a generated document.
How it works
Section titled “How it works”Embeds the imagePath image in the document and adds it at the end, in a new paragraph, with the size given in centimetres. It only works inside a session; the change stays in memory until the document is saved.
- Size:
widthCmdefaults to14; if you don’t setheightCm, the height equals the width (the image becomes square). To keep the image’s proportions, set both values. - Format: detected from the file extension:
.png,.gif,.bmp; any other extension is treated as JPEG. - The image is embedded in the
.docx: the document does not depend on the original file.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
imagePath | string | — | Path to the image file (JPEG, PNG, GIF or BMP). |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanWordSession | — | Word session. Inherited automatically inside a body. |
widthCm | number | 14 | Image width in centimetres. Accepts decimals with a dot (4.5). |
heightCm | number | same as widthCm | Image height in centimetres. |
Output
Section titled “Output”This activity does not return a value.
Example
Section titled “Example”Insert a logo at the top of a report:
Word Create path = "C:/reports/report.docx" └─ body: Word Insert Image imagePath = asset("logo.png") widthCm = 5 heightCm = 2 Word Append Paragraph text = "Monthly Report" style = TitleCommon errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Image file not found. | The imagePath does not exist on the robot’s machine. |
'imagePath' is required. | The image path is missing. |
'session' must be a valid Word session (use word-open or word-create). | The activity is outside a Word Create/Open body and got no session. |
Related activities
Section titled “Related activities”- Word Append Paragraph / Word Append Table — other kinds of content.
- Page Screenshot / Win Screenshot — produce an image to insert.