python-docx-style-id-mismatch
python-docx Style ID Mismatch (OxmlElement)
What This Skill Helps With
Use this skill when your low-level python-docx XML edits look correct in code but Word still renders the paragraph as Normal instead of the heading or list style you expected.
Ask for this skill with prompts like
Use $python-docx-style-id-mismatch to fix why my Heading 2 paragraphs render as Normal.Use $python-docx-style-id-mismatch to explain the difference between style names and style IDs in python-docx.Use $python-docx-style-id-mismatch to review this OxmlElement paragraph insertion code.
Problem
When creating Word document paragraphs using python-docx's low-level
OxmlElement API, setting w:pStyle with the style's display name
(e.g., "Heading 2") causes the paragraph to silently fall back to "Normal"
style. No error is raised. The XML requires the style ID (e.g.,
"Heading2") which differs from the display name.
More from hubeiqiao/tim-project-skills
g1-slide-deck-guide
Use when creating, reviewing, or revising a Carleton University Technology Innovation Management (TIM) Gate 1 slide deck - provides slide structure, content expectations, formatting guidance, and the six official G1 guidelines.
3tim-project-guide
Use when structuring, formatting, evaluating, or reviewing a Technology Innovation Management (TIM) project report for Carleton University — provides report rules, chapter guidance, literature review expectations, research method templates, and a compliance-audit checklist.
3pptx
Use when creating, editing, reviewing, or extracting content from PowerPoint presentation files (.pptx) - provides public workflows for python-pptx editing, speaker-note inspection, theme analysis, and OOXML-level troubleshooting.
1docx
Use when creating, editing, reviewing, or extracting content from Microsoft Word documents (.docx) - provides public workflows for text extraction, python-docx editing, template-based generation, and targeted OOXML inspection.
1pdf
Use when extracting text or tables from PDFs, filling forms, splitting or merging files, or inspecting PDF structure - provides public workflows for pypdf, pdfplumber, OCR-aware extraction, and form handling.
1