docx

Create, modify, and analyze Word .docx documents with Python OOXML.

Updated Aug 1, 2024
One-click install
npx skills add https://github.com/skkarki/Sanam --skill docx-skkarki
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/skkarki/Sanam/tree/main/skills/docx
Command: npx skills add https://github.com/skkarki/Sanam --skill docx-skkarki

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires defusedxml, Pillow, and includes scripts (resource) components.

What problem does it solve?

This Skill enables automated Word DOCX document creation, editing, and analysis, including support for tracked changes, comments, formatting preservation, and text extraction. When working with professional documents (.docx files), this Skill helps automate drafting, editing, redlining, and data extraction to save time and reduce errors.

Core Features & Use Cases

  • Programmatic DOCX creation, editing, and redlining with tracked changes to preserve audit history and collaboration.
  • Commenting and collaboration support within Word documents, including comments and metadata management.
  • Text extraction and formatting preservation for archival, reporting, or data processing.

Quick Start

Use the docx skill to generate a minimal Word document (doc.docx) with a title and a paragraph.

Frequently Asked Questions about docx

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

FAQPage Schema
How do I automate Word document creation and editing in Python?

Automating Word document creation and editing involves programmatically manipulating the OOXML structure within a .docx file. This skill uses Python and defusedxml to safely parse and modify document.xml, enabling the generation and editing of professional documents.

Can I add tracked changes and redlining to a .docx file programmatically?

Adding tracked changes and redlining to a .docx file programmatically modifies the underlying OOXML to preserve edit history. This skill supports inserting tracked changes and comments, ensuring collaboration and audit history are maintained during automated document workflows.

How does text extraction from Word documents preserve formatting?

Text extraction from Word documents that preserves formatting relies on parsing the OOXML elements directly rather than plain text conversion. This skill leverages defusedxml to safely traverse and extract content from document.xml while maintaining structural integrity.

Does this approach require unpacked .docx files to process documents?

Processing .docx files using this skill requires an unpacked workspace because it directly manipulates the internal document.xml structure. This approach allows precise OOXML modifications for tasks like redlining and formatting preservation without zipping or unzipping files manually.

What is the best way to generate contracts and reports from Word templates?

Generating contracts and reports from Word templates is best handled by programmatically editing the OOXML structure to inject data while preserving formatting. This skill automates drafting workflows by safely manipulating document.xml using Python and defusedxml.

When should I not use direct OOXML manipulation for document automation?

Direct OOXML manipulation for document automation should be avoided if your workflow requires rendering visual layouts or complex styling previews, as this skill focuses on structural XML parsing and text extraction rather than visual document rendering.