python-docx-style-id-mismatch

Installation
SKILL.md

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.

Related skills
Installs
3
GitHub Stars
1
First Seen
Mar 8, 2026