- Home
- Skills
- APIs & Backend
- docx - Word toolkit with native Office Math
docx - Word toolkit with native Office Math
This skill provides a suite of targeted Python CLIs to programmatically read, edit, and generate Word documents without losing document integrity.
Free
Works with the AI Agents you already use
docx - Word toolkit with native Office Math
Example session with this skill installed
Create a document named 'Project_Status.docx' from a JSON spec with a Level 1 heading 'Weekly Update', a bulleted list of 'Task A' and 'Task B', and a 2x2 table showing 'Status' and 'Owner'.
- Read your context and instructions
- Compiled the docx - word
I have generated the Word document based on your specification using the docx_create.py tool. The JSON spec was structured to include the heading, bullet list, and the status table as requested.
Document Generation Results
| Field | Value |
|---|---|
| Filename | Project_Status.docx |
| Blocks Created | 3 (Heading, Bullet List, Table) |
| Table Layout | 2x2 Grid (Default Style) |
| Status | Successfully written to disk |
{
"blocks": [
{
"type": "heading",
"text": "Weekly Update",
"level": 1
},
{
"type": "bullet_list",
"items": [
"Task A",
"Task B"
]
},
{
"type": "table",
"header": ["Status", "Owner"],
"rows": [
["In Progress", "Engineering"],
["Completed", "Design"]
],
"header_bold": true
}
]
}
Next steps
- Run
python scripts/docx_read.py Project_Status.docx --textto verify the content outline. - If you need specific column widths for the status table, use
docx_pack.pyto unpack andtable_width.pyto set dimensions. - To add a summary comment to the document, use
docx_comments.py add Project_Status.docx --target "Weekly Update" --text "Review required".
Connects securely to your tools. The creator never sees your data.
About this skill
Automating Word document workflows often breaks when dealing with complex formatting, nested tables, or native Office Math. Working with .docx files usually requires heavy libraries or brittle manual editing that strips out styles and metadata. This skill provides a suite of targeted Python CLIs to programmatically read, edit, and generate Word documents without losing document integrity.
What it does
- JSON-to-Docx Generation builds full documents including headings, tables, and images from structured JSON specs.
- Office Math Conversion transforms linear LaTeX or Unicode formulas into native, editable Word OMML equations.
- Table Geometry Control resolves layout issues by syncing
gridColandtcWvalues to force specific column widths. - Template Injection fills
{{token}}placeholders and applies formatting templates from one document to another. - Content Inspection extracts text, outlines, styles, images, and tracked revisions into machine-readable formats.
- Direct XML Editing provides tools to pack and unpack documents for low-level XML manipulation of document parts.
How it works
- Analyze existing documents using
docx_read.pyordocx_validate.pyto inspect structure, styles, or comments. - Transform content by running
docx_edit.pyfor text replacement ordocx_mathify.pyto upgrade formulas. - Generate new files by passing a JSON configuration to
docx_create.pyfor automated reporting. - Refine layout by unpacking the archive and using
table_width.pyto fix column dimensions.
Frameworks & tools
Built with Python 3.10+ using python-docx and lxml. It integrates latex2mathml for equation handling and requires MML2OMML.XSL (typically found in a Microsoft Office installation) for native math support.
Why this beats prompting it yourself
Generic AI prompting often produces plain text that requires manual copy-pasting into Word, losing all semantic formatting. This skill gives the agent direct, surgical control over the XML structure, allowing for precise table layouts and native equation rendering that raw text generation cannot achieve.
Use cases
- Generate recurring business reports with dynamic tables and branding from JSON data.
- Batch convert scientific manuscripts with LaTeX formulas into submission-ready Word files.
- Audit legal documents for tracked changes, comments, and specific formatting compliance.
- Automate document templating for high-volume personalized letters or certificates.
Known limitations
Does not support PDF, XLSX, or PPTX formats. Formula conversion is conservative to protect prose, and some complex equations may return a partial success code. Requires local XSL files for math.
Does not support PDF, Excel, or Slides. Requires Python 3.10+ and lxml. Math conversion depends on local MML2OMML.XSL file. Direct XML edits require unpacking/packing steps.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 11 days ago
- Free with an Agensi account
Requires