docx
DOCX Processing
Workflow Decision Tree
- Reading/Analyzing: Use text extraction or raw XML access
- Creating New Document: Use docx-js (JavaScript)
- Editing Existing: Use OOXML editing or redlining workflow
Reading Content
Text Extraction with Pandoc
# Convert to markdown with tracked changes
pandoc --track-changes=all file.docx -o output.md
Raw XML Access
# Unpack document
unzip document.docx -d unpacked/
# Key files:
# word/document.xml - Main content
# word/comments.xml - Comments
# word/media/ - Images
Creating New Documents (docx-js)
import { Document, Paragraph, TextRun, Packer } from 'docx';
import fs from 'fs';
const doc = new Document({
sections: [{
children: [
new Paragraph({
children: [
new TextRun({ text: "Hello ", bold: true }),
new TextRun({ text: "World", italics: true })
]
})
]
}]
});
const buffer = await Packer.toBuffer(doc);
fs.writeFileSync('document.docx', buffer);
Editing Existing Documents
Simple Edits
- Unpack:
unzip doc.docx -d unpacked/ - Edit
word/document.xml - Repack:
cd unpacked && zip -r ../edited.docx .
Tracked Changes (Redlining)
For professional documents, use tracked changes:
<!-- Deletion -->
<w:del w:author="Author" w:date="2025-01-01T00:00:00Z">
<w:r><w:delText>old text</w:delText></w:r>
</w:del>
<!-- Insertion -->
<w:ins w:author="Author" w:date="2025-01-01T00:00:00Z">
<w:r><w:t>new text</w:t></w:r>
</w:ins>
Converting to Images
# DOCX to PDF
soffice --headless --convert-to pdf document.docx
# PDF to images
pdftoppm -jpeg -r 150 document.pdf page
Best Practices
- Use Pandoc for text extraction
- Use docx-js for creating new documents
- For legal/business docs, always use tracked changes
- Preserve original RSIDs when editing
More from moodmnky-llc/mood-mnky-command
canvas-design
Create beautiful visual art in .png and .pdf documents using design philosophy. Use when the user asks to create a poster, piece of art, design, or other static visual piece. Creates original visual designs.
14code-refactoring
Code refactoring patterns and techniques for improving code quality without changing behavior. Use for cleaning up legacy code, reducing complexity, or improving maintainability.
13changelog-generator
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
12llm-application-dev
Building applications with Large Language Models - prompt engineering, RAG patterns, and LLM integration. Use for AI-powered features, chatbots, or LLM-based automation.
11javascript-typescript
JavaScript and TypeScript development with ES6+, Node.js, React, and modern web frameworks. Use for frontend, backend, or full-stack JavaScript/TypeScript projects.
11python-development
Modern Python development with Python 3.12+, Django, FastAPI, async patterns, and production best practices. Use for Python projects, APIs, data processing, or automation scripts.
11