#434·OfficeCLI

docx style set writes out-of-order children that fail validation (basedOn/next on Normal; highlight/rtl in style rPr)

Author: rpinckneCreated Sep 24, 2026Updated Sep 27, 2026

OfficeCLI 1.0.152 (linux-x64). Setting some style properties succeeds (exit 0) but writes children out of CT_Style or CT_RPr sequence order, so officecli validate then reports a schema error.

Repro:

bash
officecli create b.docx
officecli add b.docx /body --type paragraph --prop text=Hi --prop style=Heading1
officecli set b.docx /styles/Normal --prop basedOn=Title
officecli validate --json b.docx

Resulting word/styles.xml (Normal style):

xml
<w:style w:type="paragraph" w:styleId="Normal" w:default="true"><w:name w:val="Normal" /><w:qFormat /><w:pPr>...</w:pPr><w:basedOn w:val="Title" /></w:style>

w:basedOn is appended after w:pPr; CT_Style requires it right after w:name/w:aliases, before w:next and w:qFormat. next= on the same style does the same. On /styles/Heading1, which already has w:basedOn/w:next, both validate cleanly, so the insertion only goes wrong when the element is absent.

Style run properties:

bash
officecli set b.docx /styles/Heading1 --prop highlight=yellow   # also: rtl=true
xml
<w:rPr><w:highlight w:val="yellow" /><w:rFonts .../><w:color w:val="2F5496" /><w:sz w:val="32" />...</w:rPr>

validate: "The element has invalid child element 'w:highlight'" at /w:styles[1]/w:style[2]/w:rPr[1] (the same for w:rtl). The new child is inserted first rather than at its CT_RPr position. set /styles/Normal --prop highlight=yellow on a style with no prior rPr also fails validation.

Expected: insert each child at its schema position, as run-level set already does for the same properties.