python-docx-style-id-mismatch
python-docx Style ID Mismatch (OxmlElement)
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.
Context / Trigger Conditions
- Creating paragraphs via
OxmlElement('w:p')instead ofdoc.add_paragraph() - Setting style with
pStyle.set(qn('w:val'), 'Heading 2')(WITH space) - Paragraphs render as Normal/body text instead of the intended style
paragraph.style.nameshows "Normal" even though you set a heading style- No error or warning is raised -- complete silent failure
- Affects all styles with spaces in their display names
More from hubeiqiao/skills
apple-bento-grid
|
2pptx
Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks
1responsive-video-source-selection
|
1coding-standards
Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development.
1docx
Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks
1internal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).
1