officecli-docx

Create, edit, and validate Word .docx documents via the officecli command-line interface.

284|54|Updated Jun 23, 2026
One-click install
npx skills add https://github.com/nomifun/nomifun-desktop --skill officecli-docx-nomifun
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: officecli-docx
Source: https://github.com/nomifun/nomifun-desktop/tree/main/crates/backend/nomifun-app/assets/builtin-skills/officecli-docx
Command: npx skills add https://github.com/nomifun/nomifun-desktop --skill officecli-docx-nomifun

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working with .docx files programmatically is error-prone: raw XML manipulation, broken field codes, missing page numbers, and inconsistent formatting. This Skill provides a complete, verified workflow for building, reading, and editing Word documents through the officecli CLI, with strict output-quality rules so every document ships with proper heading hierarchy, live page-number fields, tables of contents, and clean typography. ## Core Features & Use Cases - Document creation and editing: Add paragraphs, runs, tables, lists, images, hyperlinks, tab stops, headers/footers, and sections using semantic paths like /body/p[1]. - Reading and analysis: Inspect documents with outline, text, stats, and issues views, plus CSS-like queries (e.g. paragraph[style=Heading1]) for systematic checks. - Live fields and TOC: Insert PAGE, NUMPAGES, DATE, MERGEFIELD, and TOC fields correctly, with guidance on cached-value pitfalls and static TOC fallbacks. - Use Case: Generate a quarterly business review .docx with a styled cover page, heading hierarchy, a formatted data table, a live table of contents, and a "Page X of Y" footer, then validate it before delivery. ## Quick Start Ask the AI to create a Word report named review.docx with a title heading, body paragraphs, a table of contents, and a centered page-number footer using the officecli docx skill.

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 text. Finish with officecli close and officecli validate to confirm the document has no errors.

How do I add a page number to a docx footer?▼

Run officecli add with --type footer and --prop field=page, which injects the live PAGE field automatically. Verify with get --depth 3 that the footer contains fldChar field runs rather than literal text.

Does officecli support tables of contents in Word files?▼

Yes, add a TOC with --type toc, --prop levels="1-3", and --prop hyperlinks=true. The TOC is a live field that viewers populate on open or after pressing F9; a static fallback recipe exists for recipients who cannot recalculate fields.

Why does my docx show literal $ or \n characters in text?▼

Shell escaping leaked into the document because values containing $ were not single-quoted or backslash escapes were hand-written. Quote prop values with single quotes and pass real newlines through the JSON batch layer instead of \n.

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

Yes, officecli view provides outline, text, annotated, stats, and issues modes, and officecli query supports CSS-like selectors such as paragraph[style=Heading1] or p:contains("quarterly") for targeted extraction.

What are the limitations of officecli for docx editing?▼

Internal bookmark hyperlinks, composite multi-field footers, and per-cell table borders require raw-set XML workarounds, and SEQ/PAGEREF fields emit stale cached values. The skill documents each known issue with a verified workaround.