# DOCX Tools

> Professional DOCX tools for creating, editing, and manipulating Word documents. Create new .docx with full style control, edit existing files at the XML level, handle tracked changes and comments, convert between formats, and validate OOXML structure.



Tags: Documents, DOCX, Word, Conversion


## Example Prompts

- Create a professional Word document with tables, headers, and custom styles
- Extract and review tracked changes from a DOCX file
- Add review comments to specific sections of a Word document
- Convert a .doc file to .docx or PDF format
- Validate and repair OOXML structure of a DOCX file
- Compare two document versions and generate a redlined DOCX for review
- Inspect a DOCX file's styles, headers, images, and theme for branding analysis

URL: https://rakenne.app/skills/docx-tools/index.md

Try this skill: https://rakenne.app/a/?skill=docx-tools


## Overview

Professional DOCX tools for creating, editing, and manipulating Word documents.

With this skill you can:

- Create new .docx files with full control over styles, tables, and layout
- Open and edit existing documents at the OOXML (XML) level when you need surgical precision
- Read and clean up tracked changes and comments
- Convert between formats such as .doc, .docx, PDF, HTML, and ODT
- Validate and repair OOXML structure before sending documents to clients
- Compare two versions of a document and generate a redline with tracked changes

## Getting Started

Add your source materials to the project workspace, then activate the *DOCX Tools* skill. The agent will guide you through the process step by step.

### Typical workflows

- **Draft a polished Word document**: Ask the agent to create a new .docx with the sections, headings, tables, and styles you need. The agent uses `docx_build` behind the scenes so the resulting file opens cleanly in Word.
- **Review tracked changes**: When a document has heavy editing history, the agent can use `docx_extract_text` to show a clean Markdown view, or `docx_accept_changes` to bake all accepted changes into a new, final version.
- **Deep XML surgery**: For tricky formatting or corruption issues, the agent can `docx_unpack` the file, edit XML directly, run `docx_validate` to catch structural issues, and then `docx_pack` everything back into a clean .docx.
- **Convert formats safely**: Use `docx_convert` when you need to move between .doc, .docx, PDF, HTML, or ODT while preserving as much structure as possible.
- **Compare versions with a redline**: After editing a contract or report, the agent can run `docx_compare` to generate a redlined version that opens in Word’s Track Changes view so stakeholders can quickly see what changed.
- **Generate images from PDFs**: Use `docx_pdf_to_images` to produce page-by-page images of a PDF for visual inspection or embedding in other documents.

## Tool Reference

The DOCX Tools skill exposes ten specialized tools. You do not need to remember their names—the agent will choose the right one—but this reference explains what is available.

### Create new documents

- **`docx_build`**: Programmatically builds new .docx files using the `docx` JavaScript library. Best for generating structured documents (contracts, reports, templates) with precise control over sections, paragraphs, tables, and styling.

### Read and clean up content

- **`docx_extract_text`**: Extracts the text of a .docx file as Markdown. You can choose whether to:
  - Show both insertions and deletions
  - Show only the final text (as if all changes were accepted)
  - Show the original text (as if all changes were rejected)

- **`docx_accept_changes`**: Accepts all tracked changes in a .docx and writes the result to a new file. Useful when you want a clean, final version without any editing history.

### XML‑level editing workflow

These tools are used together when the agent needs to work directly with OOXML:

- **`docx_unpack`**: Unzips a .docx into an editable directory of XML files, merging adjacent runs and pretty‑printing the XML for readability.
- **`docx_validate`**: Checks a .docx or an unpacked directory for structural issues (missing required files, malformed XML, broken relationships) and can optionally repair common problems.
- **`docx_pack`**: Re‑packs an unpacked XML directory into a new .docx file once validation passes.

### Review comments and collaboration

- **`docx_add_comment`**: Adds a review comment—or a reply to an existing comment—to an unpacked document. Comments are anchored to specific text so they appear in the expected location in Word.

### Conversions and comparisons

- **`docx_convert`**: Uses LibreOffice in headless mode to convert documents between formats, such as:
  - `.doc` → `.docx`
  - `.docx` → `pdf`
  - `.docx` → `html`
  - `.odt` → `.docx`

- **`docx_compare`**: Compares an “original” and a “modified” .docx and produces a third, redlined document. When you open the result in Word, you see insertions, deletions, and moves as tracked changes so reviewers can quickly understand the diffs.

### PDF pages to images

- **`docx_pdf_to_images`**: Converts PDF pages into JPEG or PNG images at a chosen resolution. Helpful for visual QA, slide decks, or embedding page snapshots into other documents.

## Best Practices

- **Never overwrite the original file**: The agent always writes to a new path (for example, `_clean`, `_final`, `_redlined`) so you can compare and revert.
- **Validate before sharing**: For important client documents, ask the agent to run `docx_validate` so any OOXML issues are caught before the file is sent.
- **Use build vs. XML wisely**: Prefer `docx_build` for new documents and the unpack/validate/pack workflow only when you need low‑level fixes or inspection.


---

Back to [Skill Library](https://rakenne.app/skills/index.md)
