cd /news/ai-agents/reverse-engineered-ms-word-with-pixe… · home › topics › ai-agents › article
[ARTICLE · art-182383] src=f-office.org ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Reverse engineered MS Word with pixel perfect rendering

Onur Solmaz released F-Office, an open-source Rust library on crates.io that renders Microsoft Word DOCX files with page layouts matching Word's own, built as a black-box implementation from scratch without Microsoft code. F-Office draws documents using compatifont's open fonts, which carry the widths of fonts like Calibri, Aptos and Times New Roman so lines break in the same places, and it exposes each paragraph, table, row and cell by address so AI agents can submit edits that apply all-or-nothing. The engine, its command-line tool and the fonts are on GitHub, with headless `@f-office/core` and `@f-office/docs` packages on npm; the project states its API can still change at any time, and Excel and PowerPoint support is planned.

key takeaway

F-Office's Rust engine and npm packages (`@f-office/core`, `@f-office/docs`) let an agent address each paragraph, table, row and cell, apply a batch of edits all-or-nothing, and receive the changed pages rendered as images or PDF.

by read4 min views6 publishedDec 5, 2026
Reverse engineered MS Word with pixel perfect rendering
Image: source

#

Rust library

The engine is a Rust library on crates.io. A program opens a file once and then takes its pages for its own drawing code, as images or as a PDF file.

cargo add f-office
js
use f_office::{Document, FontDatabase, Options};

let mut fonts = FontDatabase::new();
fonts.add_files(&["fonts/TinosCF-Regular.ttf".into()])?;
let docx = std::fs::read("report.docx")?;
let document = Document::open(&docx, &fonts, &Options::default())?.value;
for page in document.pages() {
    println!("{:?} by {:?}", page.width(), page.height());
}
std::fs::write("report.pdf", document.write_pdf(&fonts)?.value)?;

F-Office is a DOCX editor for AI agents as well as humans that lays out each page the way Microsoft Word does. The page below is drawn by F-Office in Tinos CF (the open font with the same layout as Times New Roman), and the slider over it shows Word's own page of the same file.

F-Office follows Word's rules for lines, paragraphs, lists, tables and pictures. The documents below are real ones in the fonts that Word documents use most, with Word's page to the left of the line and F-Office's page of the same file to the right.

          A Word document asks for fonts such as Calibri, Aptos or Times New
          Roman, which only Microsoft may give out. F-Office draws it with
          [compatifont](https://compatifont.com)'s open fonts instead, and each one has the widths of the font
          that it stands in for, so the lines break in the same places.

F-Office gives each paragraph, table, row and cell of a document an address. An agent sends a list of edits by address, F-Office makes all of them or none, and then it shows the agent the pages that changed.

            The same Rust code builds for your computer and as WebAssembly
            for a web page, so a page can draw documents in the browser with
            no server. The headless engine (`@f-office/core`) and
            drop-in F-Office Docs component (`@f-office/docs`)
            are on npm, with
            [compatifont](https://compatifont.com)'s open fonts (`@compatifont/fonts`).
npm install @f-office/core @f-office/docs @compatifont/fonts

The F stands for Free. F-Office is free and open source, so you can use it at work or at home with no fee to pay and no EULA to accept. The engine with its command line tool and the open fonts are on GitHub.

F-Office is early work, and its API can still change at any time. It renders Word documents today, and the other Office files will follow.

| Text, lists, tables, sections, columns, headers, footers, footnotes and fields | Done | | PDF files, page images and the browser | Done | | Floating pictures, text boxes and shapes that text wraps around | Done | | Comments and tracked changes as each Word prints them | Under way | | East Asian text | Under way | | Charts | Under way | | Pages identical to Word's, pixel for pixel, for each Word | Under way | | Excel and PowerPoint files | Planned |

curl -LsSf https://f-office.org/install.sh | sh F-Office opens, edits, and turns Word documents into PDFs and page images so they look the same as in Microsoft Word. It is a black-box implementation written from scratch in Rust, built by matching Word's own output without using any Microsoft code. You can run it on your computer, use it from your own programs, or try it right in your browser.

Onur Solmaz. It started because Word documents break as soon as they leave Windows, and AI agents need a reliable way to read, edit, and check pages without Microsoft Word installed.

Yes. F-Office and its open fonts are free and open source. You can use them for personal work, open source projects, or commercial products with no fees and no Microsoft license.

LibreOffice uses its own page layout rules, so Word documents often shift onto different lines and pages when you open them there. F-Office is built to match Microsoft Word's line breaks and page breaks, and it is small enough to run from the terminal, inside an app, or in a browser tab.

            Word documents ask for fonts like Calibri, Aptos, Arial, and
            Times New Roman that only ship with Windows and Office. F-Office
            pairs with
            [Compatifont](https://compatifont.com), a set of free open fonts whose letters take up the exact same
            widths, so lines break in the same places. If you already have
            Microsoft's fonts on your computer, F-Office uses those first.

That is the goal. With the same fonts, pages on supported features already match Word down to the line and pixel. Complex parts like charts, tracked changes, and East Asian scripts are still in progress. Whenever a font or feature has to be approximated, F-Office tells you instead of quietly shifting the page.

Mac, Windows, and Linux computers, as well as any modern web browser. You do not need Windows or a copy of Microsoft Word.

            Word (`.docx`) files today, with Excel and PowerPoint
            planned next. It works with any AI coding agent that can run
            terminal commands to read a document, make edits, and check how
            the pages look before and after.

No. Everything runs locally on your computer or inside your browser tab, so your documents are never uploaded to a server.

Scroll to the bottom

── more in #ai-agents 4 stories · sorted by recency
── more on @f-office 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/reverse-engineered-m…] indexed:0 read:4min 2026-12-05 · —