What This Skill Does
Create and edit .docx Word documents programmatically using python-docx. Handles formatting, layout, tables, headers, footers, and images with a bundled render script for visual verification.
When to Use It
- Creating reports, memos, letters, or templates programmatically
- Editing existing Word documents (adding sections, updating content)
- Generating formatted documents from data (mail merge patterns)
- Verifying document layout with visual rendering
Key Features
Document Creation
Build documents from scratch with proper structure — headings, paragraphs, tables, images, page breaks, and styles.Visual Verification
The bundledscripts/render_docx.py lets you render the document visually to verify formatting matches expectations before delivery.
Format Fidelity
Preserves Word-specific formatting including styles, numbering, table formatting, and page layout that plain text can't capture.Best Practices
- Always render and visually check documents before final delivery
- Use styles instead of direct formatting for consistency
- Test with the target Word version if compatibility matters
- Keep templates for repeated document types