WYSIWYG editing Image gallery upload Content templates
Word / DOCX · Updated July 2026

Word (DOCX) import & export

RichTextBox converts editor HTML to a Word .docx file and back, entirely on your server, using DocumentFormat.OpenXml — no Office install, no external service. The design goal is a faithful round-trip of editor content, not a general-purpose Word converter, and this page is honest about exactly what survives the trip.

Export: HTML → DOCX

DocxExporter turns the editor’s HTML into a downloadable Word document. It is served by the /richtextbox/export endpoint (configurable via DocxExportEndpoint).

What exports faithfully

  • Headings and paragraphs.
  • Bold, italic, and underline runs.
  • Ordered and unordered lists.
  • Tables.
  • Images embedded as data: URIs (external URLs are skipped for safety).
  • Inline style: font-weight, font-style, text-decoration, color, background-color, text-align.

Anything outside this surface is written as plain text — the exporter targets fidelity for editor output rather than arbitrary HTML.

Import: DOCX → HTML

DocxImporter reads an uploaded .docx and produces editor HTML. Enable it with the /richtextbox/import/docx endpoint (configurable via DocxImportEndpoint); the client wrapper is editor.aiToolkit.importDocx({ file, mode }) with a file-picker fallback.

What import brings across

  • Headings and text formatting.
  • Ordered and unordered lists.
  • Line breaks and tables.
  • mode is insert (at the caret) or replace (whole document).
  • A 25 MB upload cap returns a clear 413; the request is license-checked.

Honest limits

This is not a pixel-perfect Word importer. Images, footnotes, and complex Word styling are dropped on import. If you need a lossless round-trip, export from RichTextBox and re-import the same server’s output — that path is designed to survive intact.

Setup

DOCX support depends on DocumentFormat.OpenXml. The generated trial project already declares it; in your own project add the package reference and register the endpoints:

<PackageReference Include="DocumentFormat.OpenXml" Version="3.1.0" />

See the DOCX export demo for a working example, the class reference for DocxExporter / DocxImporter, and Security for how uploads are validated before they reach the importer.