[BUG] docx: `set --prop text=` on a picture run reports success but writes nothing
Summary
Setting the text property on a run that holds a drawing (a run get reports as "type": "picture") returns success: true with "Updated /body/p[1]/r[1]: text=...", but nothing is written — the string never appears in word/document.xml.
The tool already knows the run is not a text run: get on the very same path returns "type": "picture" with the picture's dimensions and relId. So the property could be rejected instead of silently accepted.
This matters for agent use: a caller that trusts the success report will believe an edit landed when it did not, and will not retry or fall back.
Environment
- OfficeCLI:
1.0.144 - OS: Windows 11 (x64)
- Source DOCX producer:
Microsoft Office Word(Word for Microsoft 365)
Reproduction
Build a Word document whose first paragraph contains an inline picture plus text, so that /body/p[1]/r[1] is the picture run and /body/p[1]/r[2] is the text run.
officecli set repro.docx "/body/p[1]/r[1]" --prop text="SHOULD_APPEAR" --json
# {"success": true, "data": "Updated /body/p[1]/r[1]: text=SHOULD_APPEAR", ...}
officecli get repro.docx "/body/p[1]/r[1]" --json
# {"path": "/body/p[@paraId=...]/r[1]", "type": "picture", "text": "図 2",
# "format": {"name": "図 2", "width": "3.5cm", "height": "2.1cm", "relId": "rId4", ...}}
officecli close repro.docx
unzip -p repro.docx word/document.xml | grep -c SHOULD_APPEAR
# 0
The same command against /body/p[1]/r[2] (the text run) works correctly and writes the string.
Expected
Either apply the text, or fail with a clear error such as text is not supported on a run of type 'picture'. A success: true result should imply the document changed.
Actual
success: true with an "Updated ..." message, and no change on disk.
Fixed on main (next release). set --prop text= on a run that holds a drawing (get reports type: picture) now returns success: false with unsupported_property instead of a silent success — the picture is untouched and nothing is written. Thanks for flagging the false success signal.
Verified fixed in v1.0.145 — thanks!
set --prop text= on a picture run now returns success: false with an unsupported_property warning and leaves the document untouched, which is exactly the contract I was hoping for. Closing.