{"slug": "f-office-rust-layout-rendering-and-editing-engine-for-docx-built-for-ai-agents", "title": "F-Office: Rust layout, rendering and editing engine for DOCX built for AI agents", "summary": "F-Office, a Rust layout, rendering and editing engine for DOCX files built for AI agents, has been released as the `f-office-cli` crate on crates.io, with the `f-office` library at version 0.2, a WebAssembly build (`@f-office/core`), a browser component (`@f-office/docs`) and a React 19 UI (`@f-office/docs-react`). The engine bundles metric-compatible open fonts from Compatifont (OFL-1.1) covering Arial, Times New Roman, Calibri, Cambria, Aptos, Courier New, Georgia, Segoe UI and Comic Sans MS, so documents paginate the same way Microsoft Word does on Linux servers, containers and browsers without Word or a Windows host. The CLI exposes `convert`, `read`, `edit`, `diff` and `skill` commands, letting agents apply atomic edit lists that either land in full or leave the file untouched and see which pages moved; F-Office Sheets (XLSX) and F-Office Slides (PPTX) are planned next.", "body_md": "A drop-in replacement for Microsoft Word, for the agentic era.\n  \n\n[Live demo (f-office.org/docs)](https://f-office.org/docs)\n  ·\n  [CLI](#install-foffice-cli)\n  ·\n  [Rust](#use-from-rust)\n  ·\n  [JavaScript / Browser](#use-from-javascript--typescript-f-officecore-and-f-officedocs)\n  ·\n  [Roadmap](#roadmap-and-status)\n\nF-Office is a Rust layout, rendering, and editing engine for DOCX documents, built for AI agents and applications that need every page to break the way Microsoft Word breaks it.\n\nIn contracts, filings, and reports, pagination is part of the document. People notice where a page ends, how a table splits across pages, and which line a signature lands on, so an edit that shifts a page break can spoil a document even when every word is right. F-Office closes that loop. An agent or program can inspect paragraphs and tables by stable address, apply atomic edit lists that either land in full or leave the file untouched, see exactly which pages moved, and render full pages or cropped diffs to PNG or PDF before handing the file back.\n\nMicrosoft Word lays out documents using Windows and Office fonts that are absent on Linux servers, containers, and browsers. The `foffice` CLI bundles metric-compatible open fonts from [Compatifont](https://github.com/osolmaz/compatifont) (OFL-1.1) so lines break at the same word on any machine, with no copy of Word and no Windows host. The same engine compiles to WebAssembly (`@f-office/core`) for browser and Node.js apps, using lazy ZIP reading, progressive Page-1-first loading, and tiled rendering to stay within mobile memory budgets, alongside the drop-in **F-Office Docs** (`F-Docs`) browser component (`@f-office/docs`) and React 19 UI (`@f-office/docs-react`).\n\nCurrently supports **F-Office Docs** (Word for Windows `word-win` DOCX files), with **F-Office Sheets** (`@f-office/sheets`, XLSX) and **F-Office Slides** (`@f-office/slides`, PPTX) planned next. The F stands for Free. Any other reading is on you.\n\nFrom crates.io:\n\n```\ncargo install f-office-cli\n```\n\nOr pre-built binaries with `cargo-binstall` (or from [GitHub Releases](https://github.com/osolmaz/f-office/releases)):\n\n```\ncargo binstall f-office-cli\n# Convert a DOCX file to PDF or PNG page images\nfoffice convert report.docx --to pdf --out out/report.pdf\nfoffice convert report.docx --to png --pages 1-3 --dpi 150 --outdir pages\n\n# Read paragraphs and tables with their addresses and page spans\nfoffice read report.docx\nfoffice read report.docx --at t1 --format json\n\n# Apply an atomic JSON edit list and see which pages changed\nfoffice edit report.docx edits.json --out report-v2.docx\n\n# Visually compare two DOCX files and render cropped changed regions\nfoffice diff report.docx report-v2.docx --outdir diff\n\n# Generate a live SKILL.md for automation agents\nfoffice skill --outdir .agents/skills\n```\n\nBy default, `foffice` bundles open metric-compatible fonts from [Compatifont](https://github.com/osolmaz/compatifont) (OFL-1.1) covering Arial, Arial Narrow, Arial Black, Times New Roman, Calibri, Cambria, Cambria Math, Aptos, Aptos Display, Courier New, Georgia, Segoe UI, Comic Sans MS, and the Office symbol fonts when those fonts are not installed on your system.\n\nThe library itself does not ship fonts. Pass your own font files or open metric-compatible fonts from [Compatifont](https://github.com/osolmaz/compatifont).\n\nAdd `f-office` to your `Cargo.toml`:\n\n```\n[dependencies]\nf-office = \"0.2\"\nuse f_office::{Document, FontDatabase, Options};\n\nfn convert_to_pdf(docx: &[u8], font_bytes: &[u8]) -> Result<Vec<u8>, Box<dyn std::error::Error>> {\n    let mut fonts = FontDatabase::new();\n    fonts.add_font(font_bytes)?;\n\n    let opened = Document::open(docx, &fonts, &Options::default())?;\n    for (index, page) in opened.value.pages().iter().enumerate() {\n        let width_pt = page.width().units() as f64 / f_office::Length::UNITS_PER_POINT as f64;\n        let height_pt = page.height().units() as f64 / f_office::Length::UNITS_PER_POINT as f64;\n        println!(\"page {}: {:.1} x {:.1} pt\", index + 1, width_pt, height_pt);\n    }\n\n    let pdf = opened.value.write_pdf(&fonts)?;\n    Ok(pdf.value)\n}\n```\n\nHeadless engine (browser and Node.js):\n\n```\nnpm install @f-office/core\njs\nimport { init, Renderer, loadFontsFor } from \"@f-office/core\";\n\nawait init();\nconst renderer = new Renderer();\n\n// Load fonts required by the document (e.g., from @compatifont/fonts or your own CDN)\nawait loadFontsFor(renderer, docxBytes, async (family) => fetchFontFamily(family));\n\nusing doc = renderer.openDocx(docxBytes, { target: \"word-win\" });\nusing page = doc.renderPage(0, 96 * devicePixelRatio);\nctx.putImageData(page.toImageData(), 0, 0);\n\n// Or export directly to PDF\nconst pdfBytes = doc.writePdf();\n```\n\nDrop-in F-Office Docs browser component (`<f-office-docs>` / `FOfficeDocs`, zero framework):\n\n```\nnpm install @f-office/docs @f-office/core\n```\n\nReact 19 Google Docs–style UI (`<DocsApp />`, `<DocsProvider>`, `<FOfficeDocs />`):\n\n```\nnpm install @f-office/docs-react @f-office/docs @f-office/core react react-dom\n```\n\nSee [`packages/core/README.md`](https://github.com/osolmaz/f-office/blob/main/packages/core/README.md) for the headless WASM engine and Web Worker API, [`packages/docs/README.md`](https://github.com/osolmaz/f-office/blob/main/packages/docs/README.md) for the framework-free `<f-office-docs>` Web Component, and [`packages/docs-react/README.md`](https://github.com/osolmaz/f-office/blob/main/packages/docs-react/README.md) for the React 19 components and composable Docs UI.\n\nF-Office is early work (`0.x`), and its public API may evolve before `1.0`.\n\n| # | Milestone | Status | \n|---|---|---|\n| 1 | Text, lists, tables, sections, columns, headers, footers, footnotes, and fields | ✅ | \n| 2 | Pixel output, PDF export, CLI ( `foffice` ), and JS/WASM engine (`@f-office/core` ) | ✅ | \n| 3 | Floating pictures, text boxes, shapes, and text wrapping | ✅ | \n| 4 | Charts (column, bar, line, pie, doughnut, scatter, combo) |  | \n| 5 | Comments and tracked changes |  | \n| 6 | East Asian text layout |  | \n| 7 | Drop-in `<f-office-docs>` Web Component (`@f-office/docs` ) | ✅ | \n| 8 | Other suite products (F-Office Sheets / XLSX, F-Office Slides / PPTX) | ❌ | \n\nLicensed under the [MIT License](https://github.com/osolmaz/f-office/blob/main/LICENSE). See [NOTICE](https://github.com/osolmaz/f-office/blob/main/NOTICE) for third-party attributions.\n\nMicrosoft, Office, Word, Excel and PowerPoint are trademarks of Microsoft. F-Office is not affiliated with Microsoft.", "url": "https://wpnews.pro/news/f-office-rust-layout-rendering-and-editing-engine-for-docx-built-for-ai-agents", "canonical_source": "https://github.com/osolmaz/f-office", "published_at": "2026-12-03 18:08:24+00:00", "updated_at": "2026-12-03 18:18:10.173549+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools", "artificial-intelligence"], "entities": ["F-Office", "Microsoft Word", "Compatifont", "crates.io", "F-Office Docs", "F-Office Sheets", "F-Office Slides", "@f-office/core"], "also_reported_by": [], "takeaway": "The `foffice` CLI bundles Compatifont's OFL-1.1 metric-compatible fonts so DOCX line breaks match Word on machines without Windows fonts, and its `edit` command applies atomic JSON edit lists that either land in full or leave the file untouched while reporting which pages moved.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/f-office-rust-layout-rendering-and-editing-engine-for-docx-built-for-ai-agents", "markdown": "https://wpnews.pro/news/f-office-rust-layout-rendering-and-editing-engine-for-docx-built-for-ai-agents.md", "text": "https://wpnews.pro/news/f-office-rust-layout-rendering-and-editing-engine-for-docx-built-for-ai-agents.txt", "jsonld": "https://wpnews.pro/news/f-office-rust-layout-rendering-and-editing-engine-for-docx-built-for-ai-agents.jsonld"}}