docx

Generate, edit, and annotate DOCX documents via OOXML and upload to S3.

36|18|Updated Nov 23, 2025
One-click install
npx skills add https://github.com/aws-samples/sample-aws-idp-pipeline --skill docx-aws-samples
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: docx
Source: https://github.com/aws-samples/sample-aws-idp-pipeline/tree/main/packages/agents/idp-agent/.skills/docx
Command: npx skills add https://github.com/aws-samples/sample-aws-idp-pipeline --skill docx-aws-samples

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires boto3, python-docx, Pillow, lxml, matplotlib, requests, defusedxml, and includes scripts (resource) components.

What problem does it solve?

This Skill streamlines creating and modifying professional Microsoft Word (.docx) documents without manual formatting work, including adding structured content and editing existing files safely.

Core Features & Use Cases

  • Create and upload DOCX reports to S3: Generate a complete .docx file (including tables, headings, images, and page layout) and upload it in one deterministic run.
  • Read and analyze DOCX content: Download a DOCX from S3 and extract paragraphs and tables for downstream processing or summarization.
  • Edit DOCX via OOXML + tracked-change tooling: Unpack a DOCX, edit WordprocessingML XML, and repack it; includes support utilities for comments and accepting tracked changes.
  • Add Word comments: Insert Word comments by updating DOCX XML (comments.xml and related parts), including replies to existing comments.

Quick Start

Use the docx skill to create a professional Word report and upload it to S3 from the user-provided content and formatting requirements.

Frequently Asked Questions about docx

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

FAQPage Schema
How do I generate a Word document with tables and images and upload it to S3?

To generate a DOCX report and upload it to S3, this solution uses python-docx to create structured content like tables and images, then performs a single-call upload to an S3 artifact path to save the final file.

Can I add tracked changes and comments to an existing DOCX file programmatically?

Yes, you can add tracked changes and comments to an existing DOCX file by unpacking the document, editing the underlying OOXML and comments.xml structures directly, and repacking the file.

How do I read and extract paragraphs and tables from a DOCX file stored in S3?

You can read and extract DOCX content from S3 by downloading the file directly into the execution environment and using python-docx to parse out paragraphs and tables for downstream processing.

Does python-docx support advanced OOXML editing for Word documents?

While python-docx handles standard document creation, advanced OOXML editing requires unpacking the DOCX file to directly manipulate the WordprocessingML XML using lxml before repacking the document.

What are the limitations of generating DOCX reports through a code interpreter environment?

This DOCX generation approach disallows shell usage and pip installs, requiring all dependencies like python-docx and Pillow to be pre-loaded and using hardcoded S3 URIs obtained via artifact_path for outputs.

How do I accept tracked changes in a Word document using Python?

You can accept tracked changes in a Word document by unpacking the DOCX file, manipulating the WordprocessingML XML to resolve the revisions, and repacking the file using the provided utility scripts.