Skip to content

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.

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: widthCm defaults to 14; if you don’t set heightCm, 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.
ParameterTypeDefaultDescription
imagePathstring—Path to the image file (JPEG, PNG, GIF or BMP).
ParameterTypeDefaultDescription
sessionZoanWordSession—Word session. Inherited automatically inside a body.
widthCmnumber14Image width in centimetres. Accepts decimals with a dot (4.5).
heightCmnumbersame as widthCmImage height in centimetres.

This activity does not return a value.

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 = Title
MessageCause 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.