office-engine

@p10node/office-engine

npm version npm downloads CI License: MIT

View + edit DOCX / XLSX / PPTX directly in the browser. Loads progressively like Google Docs, handles heavy files, one-line React embed, saves back to the original format.

npm · Live demo · Docs

The demo has samples, heavy files (300k-row sheet, 305-slide deck), drag & drop your own file, edit and download.

Real-time collaboration

Real-time collaboration: Ann and Bob edit one sheet side by side, Cara joins from a third browser

300k-row XLSX open in the browser

300k-row XLSX opening in the browser: rows stream in, then a jump to the last row

DOCX editorPPTX editor
DOCX editorPPTX editor

Install

bun add @p10node/office-engine   # peer: react >= 18, react-dom >= 18

Usage

import { DocViewer } from '@p10node/office-engine'

<DocViewer src={file} style={{ height: 600 }} />                 // File | Blob | ArrayBuffer | Uint8Array
<DocViewer src="https://cdn.example.com/report.xlsx" />          // URL → Range requests
<DocViewer src={file} editable onSave={(blob, name) => upload(blob, name)} />

CSS is auto-injected. Container must have a height.

Without React:

<script src="office-engine.embed.js"></script>   <!-- dist/, bundles React + worker -->
<office-viewer src="/files/report.docx" style="height:600px"></office-viewer>

Docs

Also online at p10node.github.io/office-engine.

Features

Full list, format coverage and limitations: Features.

FileSizeFirst paintFully loaded
DOCX 20k paragraphs1.2 MB~180 ms2073 pages in ~2s
XLSX 300k rows × 12 cols24.8 MB~330 ms~2s
PPTX 305 slides0.3 MB~110 mson-demand

Measured in headless Chromium on Apple M-series.

License

MIT © p10node