# Repository Briefing: iOfficeAI/OfficeCLI
> Source: https://repoforai.com/repo/iOfficeAI/OfficeCLI (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/iOfficeAI/OfficeCLI
- **Official Docs / Website**: https://officecli.ai
- **Category**: Agents & Frameworks (智能体与框架)
- **Primary Language**: C#
- **License**: Apache-2.0
- **Engineering Health**: A+ (95/100 · Maintenance 35/35 · Adoption 20/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v1.0.163 (2026-11-20) — https://github.com/iOfficeAI/OfficeCLI/releases
- **Review Snapshot**: 2026-12-03
- **Deployment / Stack Signals**: MCP, CLI, Self-Hosted
- **Momentum**: 33,761 ★ total (+6 24h / +135 7d) · 2,317 forks
- **Topics**: `agent`, `ai`, `claude-code`, `cli`, `codex`, `docx`, `excel`, `office`, `openclaw`, `pptx`, `presentation`, `skills`
- **When to Use**: Best for: Agent or CI workflows that generate recurring reports, edit templates, or turn Office documents into structured data, with previews and validation before delivery. Skip if: You need a desktop editor, a native in-process Python API, or exact Microsoft Office rendering and calculation without testing in the destination application.

## Overview
```text
### Architecture & Core Mechanics
OfficeCLI is a C# application shipped as a self-contained .NET binary. Its interface has three levels: semantic inspection via `view`; structured operations via commands such as `get`, `query`, `set`, and `add`; and a raw OOXML fallback via `raw`, `raw-set`, and `add-part`. The DOM uses one-based paths such as `/slide[1]/shape[2]`, not XPath. XPath is reserved for raw XML access.

A caller can drive the CLI through `--json`, use batch mode to apply multiple operations in one pass, or keep a document open in a resident session and flush it with `close`. `validate` and `view issues` give callers a way to check output after edits; structured error codes such as `invalid_value` support targeted retries. The CLI contract is concrete, but an MCP server entrypoint, transport, and tool schema are not established.

### Key Capabilities & Differentiators
OfficeCLI creates, reads, and edits `.docx`, `.xlsx`, and `.pptx`. Its renderer outputs standalone HTML with inline assets, uses a headless browser for per-page PNGs, and serves an auto-refreshing local preview through `watch`. That gives an agent a way to inspect layout after a structural edit; JSON alone cannot show text overflow or overlapping shapes.

On the spreadsheet side, the engine evaluates 350+ built-in functions on write, including spilling dynamic arrays and financial and statistical functions. Native pivot tables write both the cache and definition to OOXML. For repeatable output, `merge` fills `{{key}}` placeholders from JSON across all three formats, while `dump` serializes a whole document or a subtree into batch JSON that can be replayed with `batch`.

### Trade-offs & Limitations
Compared with `python-docx` and `openpyxl`, OfficeCLI gives an agent one subprocess interface across three formats without maintaining separate library adapters. In a Python application, however, direct library calls avoid shell argument handling and expose in-process objects. Batch and resident modes help when edits are related, but the caller still has to manage session lifetime and ensure the final file is on disk before another process consumes it.

LibreOffice and Microsoft Office are better fits when interactive editing is the main job. OfficeCLI's own renderer and evaluator are useful for feedback, not a guarantee of identical layout or calculation in the destination application. Validate package structure, then test representative layouts and formulas in the application that will open the files. Raw XML access fills gaps in DOM coverage but puts responsibility for OOXML relationships and element ordering on the caller.

### Hardware & Deployment Guide
Run the native binary on macOS, Linux, or Windows; release artifacts are listed for both x64 and ARM64 on all three. The binary embeds .NET, so no separate runtime or Microsoft Office installation is required. A platform-matched binary can run locally or in a headless CI or Docker environment. Smoke-test browser-backed screenshot capture separately on your worker image. `watch` serves a local preview at `http://localhost:26315`.

For reproducible deployments, pin the release artifact and disable background update checks with `officecli config autoUpdate false` or set `OFFICECLI_SKIP_UPDATE=1` per invocation. Recent fixes illustrate why representative-file testing matters: v1.0.162 improved validation for missing package parts referenced by content-type overrides, and v1.0.161 fixed XLSX formatting-element ordering and duplicate IDs on materialized PowerPoint placeholders.
```

## Key Capabilities
```text
- Structured edits: `--json` output and one-based element paths such as `/slide[1]/shape[2]`.
- OOXML fallback: XPath-level access through `raw` and `raw-set`, with package checks via `validate`.
- Visual feedback: HTML previews, per-page PNG capture through a headless browser, and auto-refreshing local `watch`.
- Spreadsheet computation: 350+ built-in functions, spilling dynamic arrays, and native OOXML pivot tables.
- Repeatable generation: `merge` fills JSON-backed `{{key}}` fields; `dump` and `batch` capture and replay whole documents or subtrees.
- Session lifecycle: resident mode keeps the document in memory across edits; `close` flushes the session to disk.
```

## Quick Start / Clone
```bash
curl -fsSL https://officecli.ai/SKILL.md
```
