#367·OfficeCLI

docx: indent is written as `w:ind w:start=` (ISO strict) and a later save round-trip can drop the left indent

Author: XantibodyCreated Sep 7, 2026Updated Sep 14, 2026

Summary

set --prop indent=36pt --prop hangingIndent=21pt writes the paragraph indent as

xml
<w:ind w:start="720" w:end="0" w:hanging="420" />

i.e. the ISO/Strict attribute names, while the rest of the document (Google Docs / Word transitional) uses w:left / w:right. Word accepts w:start, but in one session a subsequent officecli save round-trip lost the value:

  • 13 list paragraphs went from <w:ind w:start="720" w:hanging="420" /> to <w:ind w:hanging="420" />
  • 9 heading paragraphs lost their <w:ind w:start="1625" w:firstLine="0" /> element entirely
  • 21 body paragraphs whose indent had been written as w:left were unaffected

Re-running set --prop indent=... afterwards wrote w:left and the value survived later saves. So the loss seems tied to reading back w:start, but I could not isolate the exact operation that dropped it (the intervening operations were raw-set on /styles and /document, add --type toc, and close). Reporting what I observed rather than a minimized repro.

Environment

  • officecli 1.0.147 (aarch64-darwin, nix build via numtide/llm-agents.nix)
  • Input: .docx exported from Google Docs, later saved by Word for Mac

Observed sequence

bash
officecli open doc.docx
officecli set doc.docx "/body/p[@paraId=00000016]" --prop indent=36pt --prop hangingIndent=21pt
officecli close doc.docx
unzip -p doc.docx word/document.xml | grep -o '<w:ind [^/]*/>' | sort | uniq -c
#  13 <w:ind w:start="720" w:end="0" w:hanging="420" />      <- start/end, not left/right

# ... raw-set on /styles and /document, add --type toc, close ...

unzip -p doc.docx word/document.xml | grep -o '<w:ind [^/]*/>' | sort | uniq -c
#  13 <w:ind w:hanging="420" />                              <- left indent gone

Expected

  • Write w:left / w:right (transitional names) to match the rest of the document, and
  • never drop an existing w:start / w:left on read → write round-trip.