AI Agent Hub
Back to skills
DOCX Document Processing icon

DOCX Document Processing

Office Efficiency Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please install @user_9a74e0f8/docx-fromcpdex by following https://skillhub.cn/install/skillhub.md.

About this skill

Problem

Many .docx tasks go beyond plain text: creating formatted Word files, editing someone else’s document, preserving tracked changes, extracting comments/media/metadata, and visually checking pages all require separate XML, Pandoc, PDF, and OOXML handling. A common difficulty is that .docx files are ZIP archives of XML, so naive text replacement can corrupt runs, paragraphs, comments, revisions, and styles.

How it works

The skill routes each job and emphasizes reading the full reference docs before choosing a toolchain:

  • Read and analyze: convert with pandoc to Markdown; for comments, media, and metadata, unpack and inspect word/document.xml, word/comments.xml, and word/media/.
  • Create documents: use docx-js components such as Document, Paragraph, and TextRun, then export via Packer.toBuffer().
  • Edit documents: unpack OOXML, modify the DOM with the Python Document library, then repack into .docx.
  • Redlining review: convert to Markdown with tracked changes, group 3-10 edits, locate XML nodes precisely, mark only changed text, preserve unchanged run RSID, pack, and verify.
  • Visual checks: convert DOCX to PDF with LibreOffice, then render pages to page-*.jpg with pdftoppm.

Boundaries

Best for engineers who need precise Word XML control, not just simple text replacement. Markdown is enough for plain-text extraction, but legal documents with comments, revisions, and styles must be checked at the OOXML level. For third-party, legal, academic, business, or government documents, the material mandates a redlining workflow; generated code should stay concise, avoiding redundant variables and prints.

Use Cases

  • Legal review: apply 3-10 contract edits as OOXML tracked changes while preserving unchanged RSIDs.
  • Product docs: generate a Word file from TypeScript using docx-js paragraphs and TextRun components.
  • Pre-release layout QA: convert DOCX to PDF with LibreOffice and render pages to JPEG for review.
  • Tender analysis: extract text with Pandoc, then unpack comments.xml and media for structure review.

Best For

  • Legal engineers who turn regulatory clause edits into OOXML tracked changes.
  • Engineers generating structured Word deliverables from TypeScript via docx-js.
  • Documentation engineers inspecting comments, media, and metadata with page renders.
  • Automation engineers maintaining .docx XML workflows for document review.