| name | docx |
| description | Comprehensive Word document toolkit for reading, creating, and editing .docx files. Supports text extraction, document creation with python-docx, and tracked changes via redlining workflow. Use for legal, academic, or professional document manipulation. |
| type | reference |
| version | 1.1.0 |
| last_updated | "2026-01-02T00:00:00.000Z" |
| category | data |
| related_skills | ["pdf","pptx","document-inventory"] |
| capabilities | [] |
| requires | [] |
| tags | [] |
Docx
Overview
This skill enables comprehensive Word document operations through multiple specialized workflows for reading, creating, and editing documents.
Quick Start
from docx import Document
doc = Document("document.docx")
for para in doc.paragraphs:
print(para.text)
doc = Document()
doc.add_heading("My Title", level=0)
doc.add_paragraph("Hello, World!")
doc.save("output.docx")
Fallback: inspect .docx without python-docx
If python-docx is unavailable but the task is read-only inspection, treat .docx as a ZIP archive and extract Word XML text directly instead of stopping:
from pathlib import Path
from zipfile import ZipFile
import re
import xml.etree.ElementTree as ET
path = Path("document.docx")
with ZipFile(path) as zf:
xml = zf.read("word/document.xml")
root = ET.fromstring(xml)
ns = {"w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main"}
texts = [node.text or "" for node in root.findall(".//w:t", ns)]
print(re.sub(r"\n{3,}", "\n\n", "\n".join(texts)))
Use this for content discovery and comparison only; use a real DOCX library or office converter for preserving layout, images, tables, comments, tracked changes, and styles.