Menu

Reading and writing DOCX, PPTX and XLSX in the browser with Rust and WASM
📰

Reading and writing DOCX, PPTX and XLSX in the browser with Rust and WASM

DEV Community: rust·Sia·11 days ago
#h63VWuAR
#devtorust#devto#dev#engine#file
Long article (913 words) — no AI summary yet.
Reading 0:00
15s threshold

I built Scissor Office, an office suite for documents, slides and spreadsheets that runs in a browser tab: https://office.scissor.studio/

It opens and saves DOCX, ODT, PPTX, ODP, XLSX and ODS without sending the file to a server. This post is about how that works and where it stops.

Three Rust engines, compiled to WebAssembly

Each kind of file has its own engine, written in Rust and compiled with wasm-bindgen. These are the sizes the live site serves today:

Engine Raw Brotli

Documents 2.7 MB 1.05 MB

Presentations 1.96 MB 0.74 MB

Spreadsheets 3.08 MB 1.06 MB

Charts 0.31 MB 0.13 MB

A service worker caches them, so the app works offline after the first visit. The spreadsheet engine runs in a worker, so a big recalculation doesn't block typing.

A DOCX is a zip of XML

DOCX, PPTX, XLSX and the OpenDocument formats are all zip files full of XML parts. I wrote a small zip reader and writer on top of two crates: miniz_oxide for deflate and crc32fast for checksums. It supports just what office files need.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.