Skip to content

fix(docx-creator): fix Word Compatibility Mode + ECMA-376 ordering bugs - #286

Merged
daymade merged 1 commit into
mainfrom
fix/docx-creator-compat-mode-and-schema-order
Aug 12, 2026
Merged

fix(docx-creator): fix Word Compatibility Mode + ECMA-376 ordering bugs#286
daymade merged 1 commit into
mainfrom
fix/docx-creator-compat-mode-and-schema-order

Conversation

@daymade

@daymade daymade commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Docx files generated by this skill's Program.cs opened in real Microsoft Word in Compatibility Mode, with phantom bullet-like markers on paragraphs that were never given any numbering. Root cause: the generated package lacked a DocumentSettingsPart (settings.xml) declaring compatibilityMode, so Word fell back to legacy rendering rules.
  • While diagnosing that, found a separate, real defect class: RunProperties/ParagraphProperties/TableProperties child elements were appended out of ECMA-376's required order (e.g. color after sz, numPr after jc/spacing). minimax-docx's own validate CLI reports PASSED on files with this defect (it's an XSD validator, doesn't check element ordering) — the OpenXML SDK's own OpenXmlValidator catches it (59–79 errors on a real test doc). Fixing the ordering alone does not fix the Compatibility Mode issue and vice versa — they're independent root causes, both now fixed.
  • Added StyleDefinitionsPart + DocumentSettingsPart, fixed a missing required w:tblGrid on non-signature tables, documented both as ISSUE-012/ISSUE-013 in known_issues.md, added a mandatory "open in real Word" verification step (Step 3a) since LibreOffice cannot see this defect class at all.
  • Converted several stale line-number doc references (in SKILL.md, scripts/README.md, known_issues.md) to function/case-name references, since this change's ~44-line growth in Program.cs had already silently invalidated some of them — line numbers drift, names don't.

How this was verified

  • OpenXmlValidator (FileFormatVersions.Office2013): 0 errors after fix (was 59–79 depending on test doc).
  • Opened both the broken and fixed output in actual Microsoft Word.app: the title bar's "兼容性模式" suffix disappears, table borders/column widths render correctly.
  • Independently re-verified by a fresh-context reviewer agent that built its own separate reproduction (own throwaway OpenXmlValidator, own Word open/close test) rather than trusting this session's own checks — confirmed the same before/after counts on its own test doc.
  • Regression-audited via skill-creator's audit_skill_regression pipeline (snapshot → compare → classify → verify) against the pre-change skill bundle; all pre-existing documented behavior (alignment layering, per-list numbering restart, CJK dual-slot fonts, six-border tables, empty-header-row skip) re-verified working unchanged.
  • quick_validate and security_scan both pass.

Test plan

  • OpenXmlValidator clean (0 errors)
  • Real Microsoft Word open/close, visual check (title bar, table rendering)
  • Independent fresh-context re-verification (separate repro + separate validator run)
  • Regression audit against pre-change skill bundle — no behavior lost
  • security_scan / quick_validate pass

🤖 Generated with Claude Code

Generated docx files opened in real Microsoft Word (not LibreOffice) in
Compatibility Mode with phantom bullet markers scattered across paragraphs
that were never given any numbering. Root cause: the generator's document
lacked a DocumentSettingsPart (settings.xml) declaring compatibilityMode,
so Word fell back to legacy rendering. Fixed alongside a related but
separate issue found while diagnosing it: RunProperties/ParagraphProperties/
TableProperties child elements were appended in the wrong order relative to
ECMA-376's required sequence — this validates as PASSED under minimax-docx's
own XSD-based `validate` CLI (which doesn't check element ordering) but
fails 59-79 checks under the OpenXML SDK's own OpenXmlValidator, and is a
separate defect class from the Compatibility Mode one (fixing one alone
does not fix the other).

Independently re-verified by a fresh-context reviewer agent (own repro,
own throwaway OpenXmlValidator, own Word open/close test) before this PR.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VuCifi4WbRxkdZqQw3kqc1
@daymade
daymade merged commit 029876d into main Aug 12, 2026
4 checks passed
@daymade
daymade deleted the fix/docx-creator-compat-mode-and-schema-order branch August 12, 2026 18:32
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