---
title: "onedocument"
url: https://recursiveai.org/onedocument/
description: "Read, write, edit and render Word, Excel and PowerPoint files in .NET, in C# with no Office and no native code: DOCX, XLSX, PPTX, the legacy binary formats, ODF, RTF, HTML and Markdown, to tagged PDF, PNG and SVG. Open source, MIT or Apache-2.0. 1.0.0."
---

# onedocument

Word, Excel and PowerPoint documents in .NET, in C#. Read, write, edit and render DOCX, XLSX and PPTX, the legacy binary formats, ODF, RTF, HTML and Markdown, with no Office and no native code.

**Open source**, MIT or Apache-2.0, made by Recursive AI. Version 1.0.0 is on NuGet. Formerly OneOffice; not affiliated with Microsoft.

```sh
dotnet add package RecursiveAI.OneDocument.All
```

- [Getting started](https://recursiveai.org/onedocument/docs/getting-started/)
- [Docs](https://recursiveai.org/onedocument/docs/)
- [GitHub](https://github.com/recursive-ai-oss/onedocument-csharp)
- [NuGet](https://www.nuget.org/packages/RecursiveAI.OneDocument)

## A quick look

Open a document or a workbook by its content, read what’s in it, and convert it to a tagged PDF in one line.

The output shown is from a run on 1.0.0 from NuGet, on a report and a budget the program made itself. Getting started has the whole program.

[Getting started](https://recursiveai.org/onedocument/docs/getting-started/)

*Program.cs · C#*

```
using (Document doc = Document.Open("report.docx"))
    foreach (Paragraph p in doc.Paragraphs
             .Where(p => p.Style == "Heading 1"))
        Console.WriteLine(p.Text);
// Findings
// Next steps
 
Office.Convert("report.docx", "report.pdf");
// a one-page tagged PDF
 
using Workbook wb = Workbook.Open("budget.xlsx");
Cell total = wb.Sheets["Budget"]["D2"];
Console.WriteLine($"{total.FormattedText} = {total.Formula}");
// $591.50 = SUM(B2:B4)
```

### The formats

Read and write DOCX, XLSX and PPTX (with macro-enabled, template and Flat OPC variants), XLSB, XLS (BIFF8), RTF, ODT, ODS, ODP, CSV, HTML and Markdown. Read only: DOC, PPT, older XLS (BIFF2 to BIFF5) and Word and Excel 2003 XML. Encrypted files open with their password.

[Every format](https://recursiveai.org/onedocument/docs/overview/)

### Edits that leave the rest alone

In the README’s words: “Parts you do not touch are written back byte-identical (raw zip entries, never recompressed); edits keep unknown elements, attributes, prefixes, `mc:AlternateContent` and `extLst` in order.” Damage is repaired and reported as a located defect.

[Contracts](https://recursiveai.org/onedocument/docs/contracts/)

### PDF and page images

Documents, workbooks and presentations to tagged PDF, with PDF/UA-1 or PDF/A-2a profiles, and to PNG, JPEG, TIFF, WebP and SVG pages. Layout follows Word, Excel and PowerPoint’s rules and is measured against Office’s own PDF export.

[Layout and PDF](https://recursiveai.org/onedocument/docs/layout/)

### Calculation

A calculation engine with Excel’s semantics: dynamic arrays and spill, `LET` and `LAMBDA`, structured and 3D references, iteration, data tables, Goal Seek and pivot refresh, with Excel’s number formats. Formula text “is en-US and invariant only; localized function names are not supported.”

[Recalculation](https://recursiveai.org/onedocument/docs/spreadsheets-calc/)

### Templates and operations

One template engine across Word, Excel and PowerPoint files, mail merge and content-control binding. Merge, append, split, find and replace across runs and cells, tracked changes, protection, and rows of plain objects in and out of a workbook.

[Templates](https://recursiveai.org/onedocument/docs/templating/)

### Inspect and sanitize

Find and remove hidden data and personal information: comments, revisions, properties, hidden sheets, external links and more, in Document Inspector’s categories. Some categories are reported but not removed. **Not independently audited.**

[Inspect and sanitize](https://recursiveai.org/onedocument/docs/sanitize/)

### Redaction

Removes matched text and regions from the file, not only from view, writes a new file and re-reads every entry of it to verify. Matching is exact on the characters, so variants must be listed. **Not independently audited.**

[Redaction](https://recursiveai.org/onedocument/docs/redaction/)

### VBA as data

Read, list, extract and remove VBA projects. In the docs’ words, VBA “is never compiled, interpreted or run, the p-code is never decoded, and no password is cracked.” Removal is **not independently audited.**

[VBA projects](https://recursiveai.org/onedocument/docs/vba/)

### Accessibility and platforms

An accessibility check against Office’s published rules; agreement with Office’s own checker is pending, because it has no automation interface. NativeAOT, trimming, browser WebAssembly, iOS and Android, except encrypted files in the browser (below).

[Platforms](https://recursiveai.org/onedocument/docs/platforms/)

## What was checked for 1.0

The project’s own checks (not an external audit), each with the note that holds it, in the [overview](https://recursiveai.org/onedocument/docs/overview/).

- **Untouched round trip.** Over 4,900 public OOXML and XLSB files, “111,239 of 111,239 parts byte-identical at the package layer; 6 files refused with a typed defect.”
- **Office opens the output.** On desktop Office 16.0.20527, “718 generated files open clean” in Word, Excel and PowerPoint, with no repair prompt.
- **Calculation.** Recalculation reproduces the cached values of 99.52% of the testable formulas in 354 Common Crawl workbooks and 93.02% in 702 bug-tracker workbooks; against Excel’s own results, function rows agree 93.3%, financial 84.5% and engineering 88.0%, with every disagreement listed.
- **Layout against Office’s PDF export.** Page count agrees on 196 of 196 documents and workbooks and 24 of 24 decks. Mean text-line agreement: business documents 0.951, long documents 0.966, edge features (floats, drawings, diagrams, math) 0.834, worksheets 0.934, presentations 0.748.
- **Speed, as a ratio.** OneDocument’s median time divided by the fastest like-for-like managed library’s, over 49 rows, single thread, so below 1 means OneDocument took less time: geometric mean 0.30 on x64 and 0.32 on arm64. The slowest rows are 1.08 on x64 (writing a 10,000-row XLS, against NPOI) and 1.07 on arm64 (a streaming read of 10,000 rows, against Sylvan.Data.Excel).
- **Redaction and sanitizing reviews.** Both are the project’s own reviews (not an external audit). The redaction review: “After the fixes in this review there is no tested input from which a matched string can be read back and which the report calls verified, except the four where the plan’s literal does not match the text at all.” The sanitizer review: “Every removal the report claims holds in the 61 passing cases.” Three gaps remain, listed in the review.

[The 1.0 gates](https://recursiveai.org/onedocument/docs/gates-1-0/)

## Known gaps at 1.0.0

- **Encrypted files in the browser.** “WebAssembly has no `Aes` or MD5, so opening Agile or Standard encrypted OOXML and RC4-MD5 files there raises `OfficeUnsupportedException`. RC4 CryptoAPI and XOR files read normally.”
- **Accessibility Checker.** “Pending: Office has no automation for it, so our results are checked against the published rule set only.”
- **Signatures and encryption on write.** `RecursiveAI.OneDocument.Cryptography` “has no content yet and is not in `RecursiveAI.OneDocument.All`; it follows in a 1.x release.” Until then, encrypted files are written only for XLS.
- **Formula text** “is en-US and invariant only; localized function names are not supported.”
- **Document Inspector.** Office can be asked about only some categories, so for comments, revisions, properties, embedded documents, macros and links, agreement “was not measured; our own re-inspection finds nothing left in sanitised output.”
- **Read-only formats.** “DOC and PPT are read-only.” Excel doesn’t open the ODS files OneDocument writes, though they validate and LibreOffice opens them.
- **PDF/A-2a.** “19 of 20 DOCX and 15 of 16 PPTX pass; the failures are one rule” (a private-use character without `ActualText`).

[Every gap, in the overview](https://recursiveai.org/onedocument/docs/overview/)

## Status and packages

- **Core**: `RecursiveAI.OneDocument`: containers, the markup tree, the format registry, formulas and number formats, templates, text extraction, RTF and VBA. The others bring it in.
- **Documents**: `RecursiveAI.OneDocument.Documents`: DOCX, DOC, RTF, ODT, 2003 XML, HTML and Markdown, tracked changes, mail merge, operations.
- **Spreadsheets**: `RecursiveAI.OneDocument.Spreadsheets`: XLSX, XLSB, XLS, ODS, CSV and TSV, 2003 XML, calculation, pivots, streaming, typed rows.
- **Presentations**: `RecursiveAI.OneDocument.Presentations`: PPTX, PPT and ODP.
- **Schema**: `RecursiveAI.OneDocument.Schema`: generated typed views over every pinned OOXML and Microsoft extension schema.
- **Rendering**: `RecursiveAI.OneDocument.Rendering`: layout, charts, SmartArt, equations and drawing; PDF and page images for all three kinds.
- **All**: `RecursiveAI.OneDocument.All`: every package above, in one reference.
- **Tool**: `RecursiveAI.OneDocument.Tool`, the `onedocument` command: `dotnet tool install -g RecursiveAI.OneDocument.Tool`.
- **Status**: 1.0.0, all eight packages on one version: the first public release. Before it, the library was called OneOffice.
- **.NET**: .NET 10, C#. Depends only on the base class library and other Recursive AI libraries; no native code, no reflection. MIT or Apache-2.0.

## Go further

- [GitHub](https://github.com/recursive-ai-oss/onedocument-csharp)
- [NuGet](https://www.nuget.org/packages/RecursiveAI.OneDocument)
- [Getting started](https://recursiveai.org/onedocument/docs/getting-started/)
- [All docs](https://recursiveai.org/onedocument/docs/)
- [Coming from another library](https://recursiveai.org/onedocument/docs/migration/)
- [Checks against Office](https://recursiveai.org/onedocument/docs/office-oracle-1-0/)
- [Changelog](https://recursiveai.org/onedocument/docs/changelog/)

OneOffice is now OneDocument. OneDocument is not affiliated with Microsoft or with any other product or company named OneDocument; Word, Excel and PowerPoint name the file formats.
