Structured Word, PowerPoint, and Excel automation for .NET and coding agents, with validated plans, MCP, tracked changes, and SharePoint
OfficeAgent.NET
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
OfficeAgent.NET is a .NET document-automation library built on the
Open XML SDK. Its direct
.NET API turns document intent into typed, validated operations for Word .docx,
PowerPoint .pptx, and Excel .xlsx packages.
Use it to generate documents and presentations, make targeted edits, update tables,
styles, and images, or manage comments and review state. An MCP server and adapters
for Microsoft Agent Framework and Microsoft.Extensions.AI are optional interfaces
to the same engine. Applications can use the engine directly without MCP.
One example is a targeted Word edit whose result remains reviewable:
What this project does
An Office Open XML file is a package of related XML parts. A small change
can affect runs, styles, numbering, comments, content controls, or revision
markup. OfficeAgent.NET handles that document-specific work. The model works
with structured document data and JSON-serialisable operations such as "replace
this clause as a tracked change" or "add a row to this table."
The same engine is available in three forms:
- an MCP server for agents that support the Model Context Protocol;
- tools for Microsoft Agent Framework and Microsoft.Extensions.AI;
- a .NET API for applications that want to control the workflow directly.
It supports Word .docx, PowerPoint .pptx, and Excel .xlsx; one client routes
each document to the module that handles it. See Scope and limitations before choosing
it for a workflow that depends on Office's layout or calculation engine.
What you can build
| Area | Supported workflows |
| --- | --- |
| Word creation and editing | Create .docx files; inspect and change text, paragraphs, tables, images, styles, content controls, headers, footers, notes, page setup, and document properties |
| Word review | Read and manage comments, preserve or resolve review state, set one revision identity per plan, and record supported edits as tracked revisions |
| PowerPoint creation and editing | Build or update decks with slides, layouts, text, tables, native editable charts, images, media, notes, comments, sections, transitions, and animations |
| Excel inspection and editing | Inspect worksheets, tables, and bounded ranges; find raw or displayed values; set cells and formulas; append table rows; manage cell notes |
| Template generation | Bind unique Word content-control tags or PowerPoint shape names, expand repeating Word table rows, and create bounded batches with one receipt per output |
| Word comparison | Compare supported free-body paragraph text read-only and produce a snapshot-bound native redline plan only when all other package content is unchanged |
| Agent and application integration | Use MCP over stdio or HTTP, Microsoft Agent Framework tools, or the direct .NET API, with SHA-256 apply receipts and host-supplied audit actors |
| Document access | Work with bounded filesystem roots, SharePoint, in-memory sessions, or self-contained inline content |
Choose a starting point
| I want to... | Start here |
| --- | --- |
| Decide whether OfficeAgent fits my application | Library selection guide |
| Try a targeted Word edit | Try a Word edit |
| Use OfficeAgent in Claude Desktop, or run the server without .NET (from 1.2.0) | Standalone downloads |
| Create a Word document from scratch | Create a document |
| Create or edit a PowerPoint deck | PowerPoint support |
| Inspect or edit an Excel workbook | Excel support |
| Connect Codex, Claude Code, Copilot Studio, or Microsoft 365 Copilot | Deployment and client setup |
| Use OfficeAgent from C# | Getting started |
| Add tools to a Microsoft Agent Framework agent | Agent integration |
| Host the MCP server or use SharePoint | MCP server and document providers |
| Add per-user hosted connection authorization | Hosted gateway reference |
| Add optional PDF/page-image rendering | Visual rendering |
| Edit documents with no storage configured | Documents with no storage |
| Run a tracked-review workflow | Optional word-document-review skill |
| Build a .NET, MCP, or Agent Framework integration | Optional officeagent-integration skill |
| Build a contract-review agent | ContractReview sample |
| Populate quote templates or compare Word documents | Template and comparison workflows |
| Check support, compatibility, or security policy | Support and security |
| Contribute | Contributing |