Skip to content
←Back to Open Source

OPEN SOURCE DEEP DIVE

DeepSeeklibreofficeoffice-automation

DeepSeek open-sources dsh-libreoffice-kit: font-friendly Office conversion & rendering for Node.js agents

Open-sourced internal component of DeepSeek Harness (npm @deepseek-ai/libreoffice-kit + dsoffice CLI): Office-to-PDF export (OOXML + 97-2003 binary), spreadsheet recalculation, and page-by-page PNG rendering of Office/PDF inputs. Font-friendly = font discovery / preserve requested families / configurable fallbacks (Carlito for Calibri, Caladea for Cambria) / missingFonts reporting and budgets. Prebuilt engines for macOS ARM64/x64, Windows ARM64/x64 and Linux WASM bundle offline, with downloads slimmed 37-39%; no dependence on a user LibreOffice install.

deepseek-ai/dsh-libreoffice-kit41JavaScriptMPL-2.04 min read

An internal DeepSeek Harness component goes open source

dsh-libreoffice-kit is an internal component of DeepSeek Harness, now open-sourced as @deepseek-ai/libreoffice-kit (an npm package with a dsoffice CLI). It tackles a real pain point in agent office workflows: font-friendly Office conversion and rendering in Node.js — beyond reading diffs, agents need to read, convert, recalculate, and screenshot Office documents, and traditional setups either depend on a lucky local LibreOffice install or collapse the layout as soon as a font is missing.

Capabilities

  • Format conversion: Office → PDF export, covering OOXML (.docx/.xlsx/.pptx) and binary OLE compound documents (Office 97–2003 .doc/.xls/.ppt; renamed RTF/HTML files and .wps are not accepted).
  • Spreadsheet recalculation (recalculate): lets agents get computed values, not just formulas.
  • Direct PNG rendering: both Office and PDF inputs render page-by-page to images — exactly how an agent "looks at" a document.
  • CLI + Node API: dsoffice render/convert/recalculate; the API supports cancellation, errors and resource limits; each render owns a fresh native process or Node worker and a private profile; renders on one converter are serialized.
npm install @deepseek-ai/libreoffice-kit@0.1.3
dsoffice convert --input report.docx --output report.pdf
dsoffice render --input report.docx --output-dir report-pages --pages 1
dsoffice recalculate --input budget.xlsx --output recalculated.xlsx

What "font-friendly" means

This is the core difference from a plain LibreOffice wrapper:

  • Use available fonts: the API discovers conventional system/user font directories or indexes roots supplied via fontDirectories; fontkit reads font metadata and glyph coverage, and selected files are passed to the engine as original font bytes.
  • Preserve requested families: exact installed families take priority, including handwriting and decorative fonts; WASM font requests carry weight/italic information so matching faces can be selected; the catalog can supply additional fonts for missing glyphs.
  • Configurable substitutions: default fontFallbacks cover common Latin and Simplified Chinese families — Carlito for missing Calibri, Caladea for missing Cambria; callers can replace the defaults entirely.
  • Missing fonts and budgets exposed: missingFonts reports unavailable families declared in document XML; maxFontFiles/maxFontFileBytes/maxLoadedFontBytes bound indexing and imports; font metadata is shared in memory and a bounded user-local disk cache.

Boundaries: it bundles and downloads no font collection — deployments supply fonts per their documents and redistribution rights (minimal containers need fonts installed or a configured font directory); WASM uses only imported fonts and rejects conversion with unavailable if none are usable. This improves control but does not guarantee pixel-identical output versus Microsoft Office or between engines.

Engines and distribution: a slimmed LibreOffice built for bundling

The repo ships a complete LibreOffice slimming recipe: Java/Python, scripting and extensions, Base connectivity, PDF import, help/dictionaries/templates/icon themes, remote control and updates, and curl/WebDAV/CMIS/LDAP integrations are disabled — keeping only document import, layout, drawing and PDF export; native builds statically link Core and restrict exported symbols; the WASM build targets headless Node workers with Skia/OpenCL/OpenGL and bundled fonts disabled. Five engine packages install per platform:

Engine packagePlatform
libreoffice-kit-darwin-arm64 / darwin-x64macOS (Apple Silicon / Intel)
libreoffice-kit-win32-arm64 / win32-x64Windows ARM64 / x64 (VC++ v14 Redistributable required)
libreoffice-kit-wasmLinux (shared WASM engine)

Slimming results (historical candidate measurements, including XZ compression): macOS ARM64 download 98.85MB → 60.49MB (-38.81%), Node WASM 56.47MB → 35.85MB (-36.51%). Fidelity was verified with six synthetic DOCX/XLSX/PPTX documents (Chinese/English text, tables, formulas, images): extracted text, page counts and 96-DPI rendered pixels were identical. Installation has no compile hooks — no on-the-fly LibreOffice compilation, no extra engine downloads, no discovery of an existing user LibreOffice install; applications bundle and run fully offline.

What it means for agent office workflows

Dropped into an agent toolbox, this closes the "last mile" of document processing: read (render to PNG for multimodal models), convert (PDF export for delivery), and compute (recalculate spreadsheets for values) all get a deterministic, offline, font-controllable local path — no uploading documents to cloud converters, no dependence on whichever Office/LibreOffice version happens to be on the target machine.

Repo: github.com/deepseek-ai/dsh-libreoffice-kit (with a Chinese README, packaging and build-qualification docs).

Related Projects