Skip to content
Back to skills

Sandbox Docx

ASecurity

Build a Word document in a Code node or CodeAct action, with docx running on the host

  • 552 stars
  • 0 votes
  • 0 copies
  • 21 views
  • Added September 1, 2026
ai-agentsgonode

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 1, 2026

npx -y skills add nodetool-ai/nodetool --skill sandbox-docx --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sandbox Docx?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sandbox Docx
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nodetool-ai-sandbox-docx/badge)](https://www.skillsdirectory.com/skills/nodetool-ai-sandbox-docx)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sandbox-docx
description: Build a Word document in a Code node or CodeAct action, with docx running on the host
---

# Word documents in the sandbox

Specifier: `@nodetool-ai/sandbox-docx`. Import it at the top of the body.

`docx` builds a document out of class instances (`Paragraph`, `TextRun`,
`Table`, …) that cannot cross the guest boundary as plain data. This pack is a
**host module**: you describe the document as a JSON element list and the host
builds the real `.docx` bytes.

## build — element list to `.docx` bytes

```js
import { build } from "@nodetool-ai/sandbox-docx";

const bytes = await build({
  properties: { title: "Q3 Report", author: "NodeTool" },
  elements: [
    { type: "heading", text: "Q3 Report", level: 1 },
    { type: "paragraph", text: "Revenue grew 12% quarter over quarter.", bold: true },
    { type: "table", rows: [["Month", "Revenue"], ["Jul", "120k"], ["Aug", "134k"]] },
    { type: "pageBreak" },
    { type: "paragraph", text: "See appendix for methodology.", alignment: "CENTER" }
  ]
});
await workspace.writeBytes("report.docx", bytes);
```

Element types:

- `heading` — `text`, `level` (1–6, default 1)
- `paragraph` — `text`, `alignment` (`LEFT`/`CENTER`/`RIGHT`/`JUSTIFY`, default
  `LEFT`), `bold`, `italic`, `fontSize` (points, default 12)
- `table` — `rows`, a 2D array; every cell is stringified
- `image` — `data` (a `Uint8Array`), `width`/`height` in inches
- `pageBreak` — no fields

`properties.title`/`author`/`subject`/`keywords` set the document's metadata.

## Gotchas

- **`build` is async** and returns a `Uint8Array`.
- **Writing only.** To read an existing `.docx`, use
  `@nodetool-ai/sandbox-mammoth` instead — these are two different libraries on
  two different sides of the format.
- **Images are inches, not pixels.** `width`/`height` follow docx's own
  convention; omit them and the image renders at a fixed placeholder size.
- **10 MB per image.** The shared host-module input cap applies to each
  `data` field.

Files in this skill

  • SKILL.md2 KB
  • package.json842 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.