Skip to main content

Find and replace picture

Swap an existing picture, found by its alternative text or its position in the document, for a new image file, optionally resizing it and changing its alternative text.

Command in the Word toolkit · id ooa.word/find_replace_picture · 9 inputs (1 required), 1 output

Inputs​

InputTypeRequiredDefaultWhat it is
ImageFileYesNew image file.
Alt textStringNoReplace every picture whose alternative text equals this.
IndexNumberNo1-based position of the picture in the document; used when alt_text is empty.
SessionStringNowordSession name.
OccurrenceStringNoallWith alt_text: replace all matching pictures, or only the first or last one in document order.
New alt textStringNoNew alternative text for the replaced pictures; kept when empty.
WidthNumberNoNew width in points; kept when empty (with only height, the width follows the new image's ratio).
HeightNumberNoNew height in points; kept when empty (with only width, the height follows the new image's ratio).
PageNumberNoOnly look at pictures on this 1-based page of the body; index then counts the pictures on that page.

Outputs​

OutputTypeWhat it is
countNumberNumber of pictures replaced.