Skip to main content

docxio

JSX in, DOCX out.

Generate Word documents with JSX syntax, powered by Rust and WASM.

app.tsx
import { render } from "docxio";

const doc = (
<document title="Hello">
<section>
<paragraph>
<run bold>Hello, World!</run>
</paragraph>
</section>
</document>
);

const bytes = await render(doc);
JSX Syntax

JSX Syntax

Write documents like you write React components. No XML, no boilerplate.

Rust + WASM

Rust + WASM

Native-speed OOXML generation. 1.5M+ fuzz iterations, zero crashes.

Modular

Modular

Under 600KB minimal WASM for browsers. Full build for servers. Pick what fits.

The DX difference

Stop fighting with verbose builder APIs. Write documents the way you think about them.

Before 15 lines of builder API
const paragraph = new Paragraph({
children: [
new TextRun({
text: "Hello, World!",
bold: true,
font: { name: "Calibri" },
size: 24,
}),
],
spacing: { after: 200 },
});
const doc = new Document({
sections: [{ children: [paragraph] }],
});
const buffer = await Packer.toBuffer(doc);
After 13 lines with docxio13% less code
const doc = (
<document>
<section>
<paragraph>
<run bold font="Calibri" size={24}>
Hello, World!
</run>
</paragraph>
</section>
</document>
);

const bytes = await render(doc);
176+
Tests
1.5M+
Fuzz iterations
<600KB
Min WASM size
23
JSX components

Get started in seconds

npm install docxio
Read the docs →