This document catalogues every rule that makes a DOCX file valid in Microsoft Word. Each rule was discovered through systematic debugging: round-trip testing (load → save → open in Word), swap-testing (isolate which part causes failure), and repair analysis (diff broken vs Word-repaired).
1. How to use this reference
-
Reconciler authors — see Reconciler Mapping to find which method enforces each rule
-
Validation rule authors — see Validation Mapping to find which DOC-code checks each rule
-
Contributors — follow the rule template below to add new rules
2. Rule template
Each rule document follows this structure:
== Rule ID: R{n}
**Summary:** one-line description
**Severity:** error / warning / info
**Applies to:** which XML parts
=== What Word expects
Detailed description of the valid state.
=== What happens on violation
Error message or behavior.
=== Reconciler enforcement
Which reconciler method ensures this, and how.
=== Validation rule
Which DOC-{code} checks this.
=== Example
Valid vs invalid XML snippet.
3. Rules by category
3.1. Package Structure
-
R8: Required Parts — a DOCX must contain [Content_Types].xml, _rels/.rels, word/document.xml
-
R7: Content Types Coverage — every ZIP entry must be covered by a content type declaration
3.2. Namespace Consistency
-
R1: mc:Ignorable Namespace Consistency — all listed prefixes must have xmlns declarations in scope
3.3. Relationship Integrity
-
R6: Relationship Cross-Reference Integrity — rId values must be consistent across parts and .rels files, targets must exist in ZIP
3.4. Settings
-
R2: Settings Value Formats — w15:docId must be GUID format
3.5. Theme
-
R3: Theme fmtScheme Completeness — fill/line/effect/bgFill style lists must have minimum content
3.6. Numbering
-
R4: Level Element Preservation — all w:lvl children must round-trip
-
R5: Instance lvlOverride Preservation — lvlOverride/startOverride inside w:num must be preserved
3.7. Styles
-
R10: Style Definition Completeness — minimum default styles must exist
3.8. Footnotes and Endnotes
-
R9: Footnote/Endnote Consistency — footnotePr ↔ footnotes.xml must be consistent
3.9. Section Properties
-
R11: Section Properties — sectPr with pgSz and pgMar must exist
3.10. Document Metadata
-
R12: Document rsids — paragraphs should have rsidR and rsidRDefault attributes
-
R13: Font Table Signatures — sig elements should have valid attributes
-
R14: Core Properties Namespaces — dc/dcterms/xsi namespaces must be declared
3.11. Headers and Footers
-
R15: Header/Footer Reference Consistency — references must resolve to existing parts