DOCX

Use when the user wants to create, edit, or format Word documents (.docx files).

anujkumar8076 Updated

File contents

Word Document Skill

Create and edit .docx files programmatically.

Setup

Install the python-docx library before starting:

pip install python-docx

Creating a document

Use python-docx to build the document. Add headings, paragraphs, and tables through the Document API, then save to disk.

from docx import Document
doc = Document()
doc.add_heading("Title", level=1)
doc.add_paragraph("Body text goes here.")
doc.save("output.docx")

Editing an existing document

Open the file with Document(path), iterate doc.paragraphs, modify runs in place, and save under a new name so the original is preserved.

Output format

Always save the result as a .docx file and tell the user the absolute path.

anujkumar8076/skill-router-mcp/tree/main/skills/docx commit c4baac2271

Frequently asked questions

npx skillmds@latest add anujkumar8076/docx