officecli-docx

Create, edit, and validate Word .docx documents using the officecli command-line tool.

Updated Jul 10, 2026
One-click install
npx skills add https://github.com/Grong/openhub-client --skill officecli-docx-grong
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: officecli-docx
Source: https://github.com/Grong/openhub-client/tree/main/crates/backend/openhub-app/assets/builtin-skills/officecli-docx
Command: npx skills add https://github.com/Grong/openhub-client --skill officecli-docx-grong

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working with .docx files programmatically is error-prone: raw XML manipulation, broken page-number fields, unpopulated tables of contents, and inconsistent formatting are common failure points. This Skill provides a complete, verified workflow for building, reading, and editing Word documents through the officecli CLI so every deliverable meets professional formatting standards. ## Core Features & Use Cases - Document creation and editing: Build reports, letters, memos, and proposals with proper heading hierarchy, styles, tables, lists, images, hyperlinks, headers, footers, and live page-number fields. - Reading and analysis: Extract text, inspect document structure via outline views, and query elements with CSS-like selectors for systematic QA. - Field and TOC handling: Insert live PAGE, NUMPAGES, DATE, MERGEFIELD, and TOC fields, with verified recipes for composite footers and static TOC fallbacks. - Use Case: Generate a quarterly business review document with a styled cover page, multi-level headings, a formatted data table with a dark header row, a table of contents, and a "Page X of Y" footer, then validate the output before delivery. ## Quick Start Ask the assistant to create a Word report with a title page, three headed sections, a table of contents, and page numbers in the footer using officecli.

Frequently Asked Questions about officecli-docx

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

FAQPage Schema
How do I create a Word document from the command line?

Use officecli create to make the file, then officecli add to insert paragraphs, headings, tables, and footers with properties like style, size, and spacing. Finish with officecli close and officecli validate to confirm the document has no errors.

How do I add page numbers to a docx footer?

Add a footer with the field property: officecli add with --type footer and --prop field=page inserts a live PAGE field automatically. Do not hand-compose fldChar XML or set differentFirstPage separately, as that property is unsupported.

Why does my table of contents show placeholder text in Word?

The TOC is a live field whose cached value is empty until recalculated. Recipients can press F9 in Word to refresh it, or you can build a static TOC fallback with literal heading rows when readers cannot recalculate fields.

Can I extract text and structure from an existing docx file?

Yes. Use officecli view with the outline, text, or annotated modes to inspect headings and content, and officecli query with CSS-like selectors to find specific elements such as empty paragraphs or images missing alt text.

What platforms does officecli support for docx editing?

officecli runs on macOS, Linux, and Windows. Install it via the official install scripts or download binaries manually from the GitHub releases page, then verify the installation with officecli --version.