Skip to content

ooxml ordering errors and fixes - #882

Open
Xemptuous wants to merge 1 commit into
bokuweb:mainfrom
Xemptuous:ooxml-validation-fixes
Open

ooxml ordering errors and fixes#882
Xemptuous wants to merge 1 commit into
bokuweb:mainfrom
Xemptuous:ooxml-validation-fixes

Conversation

@Xemptuous

Copy link
Copy Markdown

What does this change?

Reorders items to conform to expected standards, otherwise docx can't open in many editors, notably microsoft word.

  • removed unnecessary empty <w:rPr> from styles
  • removed incorrect <w:type> from <w:gridCol>
  • reordered others to conform to expected ordering

Didn't update test suites as I don't have the time atm, might get to it eventually, just putting this up for visibility. Likely many more places the ordering is wrong. I just fixed what I use and that is likely the most common issues others will face.

dcasota added a commit to dcasota/mt-fhnw-agentic that referenced this pull request Jun 16, 2026
…ons (#406)

Word COM's INDEX field expansion (e.g. `INDEX \c 2`) inserts NEW
section-break paragraphs whose pPr emits rPr BEFORE sectPr — re-
violating CT_PPr after the render-time fix_ppr_schema_order pass
already corrected the original docx. The 2-pass behaviour was
observed in governing_the_agentic_machine.docx (2 broken pPr /
2,320 total). All other 16 books in the cascade verified clean.

This commit adds a second invocation of fix_ppr_schema_order inside
collapse_empty_header_footer_parts (post-finalize pass), so the on-
disk bytes Word releases are re-cleaned before the cascade audit.
Idempotent: already-correct pPr is left untouched. New unit test
`fix_ppr_schema_order_moves_rpr_after_sectpr` locks the sectPr
case. Verified on the affected book: 0 broken / 736 styled / 1,050
total after re-finalize.

Also includes deliverable_gate fix (#400 follow-up): the
NON_ENGLISH_TEXT scanner suppresses the German-term check on
`*.de.md` / `*_DE.md` (and fr/it/rm/hi siblings) — those sidecars
are translated deliverables, not English-only deliverables.

Upstream root cause: docx-rs 0.4.20 (latest) does not enforce
CT_PPr child order; tracked as bokuweb/docx-rs#882 (open, not
merged). The post-process hack is required until that lands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant