OfficeCLI README

The project's README from github.com/iOfficeAI/OfficeCLI. As one markdown file: README.md.

OfficeCLI

OfficeCLI is the world's first and the best Office suite designed for AI agents.

Give any AI agent full control over Word, Excel, and PowerPoint — in one line of code.

Open-source. Single binary. No Office installation. No dependencies. Works everywhere.

OfficeCLI's built-in HTML rendering engine reproduces documents with high fidelity — and that's what gives AI eyes. It renders .docx / .xlsx / .pptx to HTML or PNG, closing the render → look → fix loop.

GitHub Release License

English | 中文 | 日本語 | 한국어

🌐 Website: officecli.ai  |  💬 Community: Discord

OfficeCLI creating a PowerPoint presentation on AionUi

PPT creation process using OfficeCLI on AionUi

PowerPoint Presentations

OfficeCLI design presentation (PowerPoint) OfficeCLI business presentation (PowerPoint) OfficeCLI tech presentation (PowerPoint)
OfficeCLI space presentation (PowerPoint) OfficeCLI gaming presentation (PowerPoint) OfficeCLI creative presentation (PowerPoint)

—

Word Documents

OfficeCLI academic paper (Word) OfficeCLI project proposal (Word) OfficeCLI annual report (Word)

—

Excel Spreadsheets

OfficeCLI budget tracker (Excel) OfficeCLI gradebook (Excel) OfficeCLI sales dashboard (Excel)

All documents above were created entirely by AI agents using OfficeCLI — no templates, no manual editing.

For AI Agents — Get Started in One Line

Paste this into your AI agent's chat — it will read the skill file and install everything automatically:

curl -fsSL https://officecli.ai/SKILL.md

That's it. The skill file teaches the agent how to install the binary and use all commands.

For Humans

Option A — GUI: Install AionUi — a desktop app that lets you create and edit Office documents through natural language, powered by OfficeCLI under the hood. Just describe what you want, and AionUi handles the rest.

Option B — CLI: Download the binary for your platform from GitHub Releases, then run:

officecli install

This copies the binary to your PATH and installs the officecli skill into every AI coding agent it detects — Claude Code, Cursor, Windsurf, GitHub Copilot, and more. Your agent can immediately create, read, and edit Office documents on your behalf, no extra configuration needed.

For Developers — See It Live in 30 Seconds

# 1. Install (macOS / Linux) — or: brew install officecli / npm install -g @officecli/officecli
curl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash
# Windows (PowerShell): irm https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.ps1 | iex

# 2. Create a blank PowerPoint
officecli create deck.pptx

# 3. Start live preview — opens http://localhost:26315 in your browser
officecli watch deck.pptx

# 4. Open another terminal, add a slide — watch the browser update instantly
officecli add deck.pptx / --type slide --prop title="Hello, World!"

That's it. Every add, set, or remove command you run will refresh the preview in real time. Keep experimenting — the browser is your live feedback loop.

Quick Start

# Create a presentation and add content
officecli create deck.pptx
officecli add deck.pptx / --type slide --prop title="Q4 Report" --prop background=1A1A2E
officecli add deck.pptx '/slide[1]' --type shape \
  --prop text="Revenue grew 25%" --prop x=2cm --prop y=5cm \
  --prop font=Arial --prop size=24 --prop color=FFFFFF

# View as outline
officecli view deck.pptx outline
# → Slide 1: Q4 Report
# →   Shape 1 [TextBox]: Revenue grew 25%

# View as HTML — opens a rendered preview in your browser, no server needed
officecli view deck.pptx html

# Get structured JSON for any element
officecli get deck.pptx '/slide[1]/shape[1]' --json

# Save and close — flushes the resident session to disk
officecli close deck.pptx
{
  "tag": "shape",
  "path": "/slide[1]/shape[1]",
  "attributes": {
    "name": "TextBox 1",
    "text": "Revenue grew 25%",
    "x": "720000",
    "y": "1800000"
  }
}

Why OfficeCLI?

What used to take 50 lines of Python and 3 separate libraries:

from pptx import Presentation
from pptx.util import Inches, Pt
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[0])
title = slide.shapes.title
title.text = "Q4 Report"
# ... 45 more lines ...
prs.save('deck.pptx')

Now takes one command:

officecli add deck.pptx / --type slide --prop title="Q4 Report"

What OfficeCLI can do:

Format Read Modify Create
Word (.docx) ✅ ✅ ✅
Excel (.xlsx) ✅ ✅ ✅
PowerPoint (.pptx) ✅ ✅ ✅

Word — full i18n & RTL support (per-script font slots, per-script BCP-47 lang tags lang.latin/ea/cs, complex-script bold/italic/size, direction=rtl cascading through paragraph/run/section/table/style/header/footer/docDefaults, rtlGutter + pgBorders shorthand, locale-aware page numbering for Hindi/Arabic/Thai/CJK; create --locale ar-SA auto-enables RTL), paragraphs (framePr, tabs shorthand, char-based indents), runs (underline.color, position half-pts), tables (virtual column ops add/remove/move/copyfrom, hMerge), styles, textbox / shape (textbox: rotation, textDirection eaVert/vert270, gradient, shadow, opacity), headers/footers, images (PNG/JPG/GIF/SVG), equations (LaTeX input), diagrams (mermaid → native editable shapes, or any mermaid type as a full-fidelity PNG), comments, footnotes, watermarks, bookmarks, TOC, charts, hyperlinks, sections, form fields, content controls (SDT), fields (22 zero-param types + MERGEFIELD / REF / PAGEREF / SEQ / STYLEREF / DOCPROPERTY / IF), OLE objects, revisions / tracked changes (revision.type=ins\|del\|format\|moveFrom\|moveTo + revision.action=accept\|reject, per-target /revision[@author=Alice] selector, tracked Find&Replace), page background color, document properties

Excel — cells (phonetic guide / furigana on add, Excel-UI --shift left\|up on remove / shift=right\|down on add), formulas (350+ built-in functions with auto-evaluation, spilling dynamic arrays with _xlfn. auto-prefix, financial / bond and statistical families, OFFSET/INDIRECT, defined-name formula bodies inlined at parse, formula-ref rewrite on row/col insert), sheets (visible/hidden/veryHidden, print margins, printTitleRows/Cols, RTL sheetView, cascade-aware sheet rename, empty-cell bloat filter on open), boolean and/or selectors (row[Salary>5000 and Region=EMEA]), tables, sort (sheet / range, multi-key, sidecar-aware), conditional formatting, charts (including box-whisker, pareto with auto-sort + cumulative-%, log axis), pivot tables (multi-field, date grouping, showDataAs, sort, grandTotals, subtotals, compact/outline/tabular layout, repeat item labels, blank rows, calculated fields, persistent labelFilter / topN filters, cache CoW + cross-pivot sharing), slicers, named ranges, data validation, images (PNG/JPG/GIF/SVG with dual-representation fallback), sparklines, comments (RTL), autofilter, shapes, OLE objects, CSV/TSV import, $Sheet:A1 cell addressing

PowerPoint — slides (header/footer/date/slidenum toggles, hidden), shapes (pattern fill, blur effect, hyperlink tooltip + slide-jump links, highlight color on runs, slideMaster/slideLayout typed add/set/remove, arrow alias, effective.X + effective.X.src), images (PNG/JPG/GIF/SVG, fill modes: stretch/contain/cover/tile, brightness/contrast/glow/shadow, rotation, link + tooltip), tables (built-in PowerPoint style catalogue, virtual /col[C] get + swap/copyFrom, row/col Move/CopyFrom, fill/background alias), charts (pieOfPie, barOfPie, per-attr axisLine/gridline setters, series add/remove with theme palette, anchor=x,y,w,h shorthand), animations (15 emphasis + 16 exit template-backed presets, multi-effect chains, motion-path presets, repeat/restart/autoReverse, chart animations + chartBuild), transitions (morph + p14 + 12 p15 PowerPoint 2013+ presets), 3D models (.glb) (combined rotation=ax,ay,az), slide zoom, equations (LaTeX input), diagrams (mermaid flowchart / sequence → native editable shapes, or any mermaid type as a full-fidelity PNG), themes, connectors (from/to accept a full /slide[N]/shape[@name=Foo] path), video/audio (loop, autoStart), groups (link + tooltip; Get/Query/Add/Remove all descend into groups), notes (RTL, lang), comments (RTL, legacy + modern p188 threaded round-trip), SmartArt (round-trip via add-part + raw-set), OLE objects, placeholders (add/set by phType)

Use Cases

For Developers:

For AI Agents:

For Teams:

Installation

Ships as a single self-contained binary. The .NET runtime is embedded -- nothing to install, no runtime to manage.

One-line install:

# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.sh | bash

# Windows (PowerShell)
irm https://raw.githubusercontent.com/iOfficeAI/OfficeCLI/main/install.ps1 | iex

Or via a package manager:

# Homebrew (macOS / Linux)
brew install officecli

# Scoop (Windows)
scoop install officecli

# npm (all platforms — fetches the native binary for your platform)
npm install -g @officecli/officecli

Or download manually from GitHub Releases:

Platform Binary
macOS Apple Silicon officecli-mac-arm64
macOS Intel officecli-mac-x64
Linux x64 officecli-linux-x64
Linux ARM64 officecli-linux-arm64
Windows x64 officecli-win-x64.exe
Windows ARM64 officecli-win-arm64.exe

Verify installation: officecli --version

Or self-install from a downloaded binary (or run bare officecli to auto-install):

officecli install    # explicit
officecli            # bare invocation also triggers install

Updates are checked automatically in the background. Disable with officecli config autoUpdate false or skip per-invocation with OFFICECLI_SKIP_UPDATE=1. Configuration lives under ~/.officecli/config.json.

Key Features

Built-in Engines & Generation Primitives

OfficeCLI is self-contained. The capabilities below ship inside the binary — no Office required.

Rendering engine — high-fidelity, built-in

OfficeCLI's keystone: a from-scratch, high-fidelity HTML rendering engine that lets an AI agent see the rendered document instead of guessing from the DOM. It covers shapes, charts (trendlines, error bars, waterfall, candlestick, sparklines), equations (OMML → LaTeX, rendered with KaTeX), 3D .glb models via Three.js, morph transitions, slide zoom, and shape effects. Per-page PNG screenshots are produced by piping the rendered HTML through a headless browser. Three modes:

officecli view deck.pptx html -o /tmp/deck.html
officecli view deck.pptx screenshot -o /tmp/deck.png # add --page 1-N for more slides
officecli watch deck.pptx                            # http://localhost:26315

Without visualization, an agent generating slides is flying blind — it can read the DOM but can't tell if the title overflows or two shapes overlap. Because rendering is built into the binary, the render → look → fix loop works in CI, in Docker, on a server with no display — anywhere the binary runs.

Formula & pivot engine

350+ built-in Excel functions evaluated automatically on write — write =SUM(A1:A2), get the cell, the value is already there. No round-trip through Office to recalc. Covers spilling dynamic arrays (FILTER / SORT / UNIQUE / SEQUENCE / LET / LAMBDA / MAP), VLOOKUP / XLOOKUP / INDEX / MATCH, financial & bond math (XIRR / PRICE / YIELD / DURATION / COUPNUM), statistical distributions, tests & regression (NORM.DIST / T.TEST / LINEST), and date & text functions.

Plus native OOXML pivot tables from a source range with one command — multi-field rows/cols/filters, 10 aggregations, showDataAs modes, date grouping, calculated fields, top-N, layouts. Pivot cache + definition are written to OOXML, so Excel opens the file with the aggregation already populated:

officecli add sales.xlsx '/Sheet1' --type pivottable \
  --prop source='Data!A1:E10000' --prop rows='Region,Category' \
  --prop cols=Quarter --prop values='Revenue:sum,Units:avg' \
  --prop showDataAs=percentOfTotal

Template merge — generate once, fill many

merge replaces {{key}} placeholders in any .docx / .xlsx / .pptx with JSON data — across paragraphs, table cells, shapes, headers, footers, and chart titles. Agent designs the layout once (expensive); production code fills it N times (cheap, deterministic, zero token cost). Avoids the failure mode where an agent regenerates each report from scratch and produces N inconsistent layouts.

officecli merge invoice-template.docx out-001.docx --data '{"client":"Acme","total":"$5,200"}'
officecli merge q4-template.pptx q4-acme.pptx --data data.json

Round-trip dump — learn from existing docs

dump serializes any .docx, .pptx, or .xlsx — whole document or any subtree (a single paragraph, table, slide, worksheet, the styles part, numbering, theme, or settings) — into a replayable batch JSON; batch r

OfficeCLI (iOfficeAI/OfficeCLI)

Searching Database…

32.1K ·GitHub
这是什么东西?一个专为 AI 智能体打造的开源 Office 套件:让任何 AI 智能体都能完全操控 Word、Excel 和 PowerPoint——读取、编辑和创建文档——而且直接在命令行里就能完成。
那它是一个我直接运行的程序,还是一个写代码时调用的库?它是一个命令行工具,不是库:一个独立的二进制文件,直接用来处理 .docx、.xlsx 和 .pptx 文件。如果你不想碰终端,可以用 AionUi 桌面应用,用自然语言来操作它。
我需要先装好 Microsoft Office 或 .NET 运行时吗?都不需要。.NET 运行时已经内置在二进制文件里,也不要求安装 Office——渲染引擎和公式引擎都随二进制文件一起提供。
有什么需要留意的坑吗?有两个小地方:逐页导出 PNG 截图是把渲染好的 HTML 通过无头浏览器处理生成的;另外它会在后台自动检查更新——可以用 officecli config autoUpdate false 或 OFFICECLISKIPUPDATE=1 关掉这个功能。
它只给 AI 智能体用,还是人也能用?两者都可以。README 里提到:开发者用它自动生成报告和批量编辑,团队用它克隆模板并填入数据,智能体则用它生成演示文稿,或者从文档里提取结构化数据输出成 JSON。
它在 Windows 和 Linux 上能用吗,还是只有 Mac 能用?三个平台都支持:提供 macOS(Apple Silicon 和 Intel)、Linux(x64 和 ARM64)以及 Windows(x64 和 ARM64)的预编译二进制文件。由于它是独立自包含的,还能在 Docker、CI 以及没有显示器的服务器上以无界面模式运行。
一个处理 Office 文件的命令行工具,为什么要内置渲染引擎?这样智能体就能看到自己做出的东西:OfficeCLI 可以把 .docx、.xlsx 和 .pptx 渲染成高保真的 HTML 或逐页的 PNG,让智能体检查排版并修复问题——也就是渲染、查看、修复这个循环——即使在没有显示器的机器上的 CI 或 Docker 环境里也能做到。
它到底能修改文件里的哪些内容?几乎什么都能改:文字、字体、颜色、布局、公式、图表、图片。亮点包括:Word 的修订记录和目录、Excel 的数据透视表外加 350 多个写入时即求值的公式函数,还有 PowerPoint 的动画、平滑切换和 3D .glb 模型。
它支持把数据填进模板吗?支持——merge 命令会用 JSON 数据替换任何 .docx、.xlsx 或 .pptx 里的 {{key}} 占位符,覆盖段落、表格单元格、形状、页眉、页脚和图表标题。布局只需设计一次,之后就能低成本地填充 N 次。
我边做边改的时候,能实时预览效果吗?可以——watch 模式会启动一个本地 HTTP 服务器,并在浏览器里显示自动刷新的预览:每执行一条 add、set 或 remove 命令,页面都会立即更新。Excel 的 watch 模式甚至还支持直接在预览里编辑单元格,以及拖拽调整图表位置。
Creator
iOfficeAI
Size
315.2 MB
Stars
32.1K
Age
7mo
Commits · 90 Days