docx

Create, read, edit, and convert Microsoft Word .docx files using python-docx and Pandoc.

1|Updated May 26, 2026
One-click install
npx skills add https://github.com/nimdvir/dima-publishing --skill docx-nimdvir
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/nimdvir/dima-publishing/tree/main/.agents/skills/docx
Command: npx skills add https://github.com/nimdvir/dima-publishing --skill docx-nimdvir

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires python-docx, pandoc, comtypes.

What problem does it solve? Working with Word documents programmatically is tedious and error-prone without clear guidance on the right library, style handling, and conversion options. This Skill provides ready-to-use patterns for creating, reading, editing, formatting, and converting .docx files so you can produce polished Word documents without trial and error. ## Core Features & Use Cases - Document Creation & Editing: Build documents from scratch or templates with headings, paragraphs, lists, tables, images, headers, footers, and page numbers using python-docx. - Content Extraction: Read text, tables, and styles from existing .docx files and export them to Markdown-style structured text. - Pandoc Conversion: Convert Markdown or HTML to DOCX (with reference templates for styling) and convert DOCX back to Markdown with media extraction. - Use Case: A courseware author writes chapter content in Markdown, then runs Pandoc with a reference.docx template to produce a styled chapter document with headers, footers, and page numbers ready for publication. ## Quick Start Ask the AI to create a Word report from your Markdown notes with a header, page numbers in the footer, and a styled table of your data.

Frequently Asked Questions about docx

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Word document in Python?▼

Use python-docx: install it with pip, then call Document() to create a file and add headings, paragraphs, lists, tables, and images before saving with doc.save(). The library works without Microsoft Office installed.

How do I convert Markdown to DOCX with Pandoc?▼

Run pandoc input.md -o output.docx for a basic conversion. Add --reference-doc=reference.docx to apply styles from a Word template, and use -f gfm for GitHub Flavored Markdown input.

python-docx vs Pandoc for Word documents?▼

Use python-docx for programmatic creation, editing, and reading of .docx files with fine-grained control over styles and elements. Use Pandoc when converting existing Markdown or HTML content into Word format, especially for textbook-style content.

How do I extract text and tables from a .docx file?▼

Load the file with Document("input.docx"), iterate doc.paragraphs for text with style names, and iterate doc.tables to read rows and cells. You can map heading styles to Markdown syntax for structured export.

Why is my style not found in python-docx?▼

The style name must exist in the document's style definitions. List available styles with [s.name for s in doc.styles], or load a reference template that already contains the styles you need.

Can python-docx password-protect a Word document?▼

python-docx can add editing restrictions via XML settings, but the protection is weak and not cryptographically secure. For real protection on Windows with Office installed, use COM automation with Word's Protect method.