DOCX Export

The editor exports its HTML to a Microsoft Word .docx file via a server endpoint you control. The server uses MIT-licensed DocumentFormat.OpenXml to build the document (paragraphs, headings, lists, tables, inline formatting, hyperlinks, data-URI images, text alignment, colors). No external service, no cloud API, no DOCX SaaS subscription.

This is a server-driven feature.The demo below calls a mock endpoint that returns the editor’s HTML as an illustration — for a live DOCX response, wire up the ASP.NET CoreRichTextBox.AspNetCore endpoint or your own converter.

Quarterly update

Summary. Revenue grew 15% year-over-year.

  • Two new enterprise customers in March.
  • Streaming AI shipped in preview.10.
Our buyers want one perpetual license, not three subscription SKUs.

Example code

<div id="docx_editor">
    <h3>Quarterly update</h3>
    <p><strong>Summary.</strong> Revenue grew <em>15%</em> year-over-year.</p>
    <ul><li>Two new enterprise customers in March.</li><li>Streaming AI shipped in preview.10.</li></ul>
    <blockquote>Our buyers want one perpetual license, not three subscription SKUs.</blockquote>
</div>

<button type="button" onclick="exportToDocx()">Export to .docx</button>
<span id="docxStatus"></span>

<script>
    var docxEditor = new RichTextEditor("#docx_editor", { toolbar: "default" });

    function exportToDocx() {
        var status = document.getElementById("docxStatus");
        status.textContent = "Calling server endpoint...";

        if (!docxEditor.aiToolkit || typeof docxEditor.aiToolkit.exportDocx !== "function") {
            status.textContent = "exportDocx helper not available (make sure aitoolkit.js is loaded).";
            return;
        }

        docxEditor.aiToolkit.exportDocx({
            url: "/richtextbox/export/docx",
            fileName: "quarterly-update.docx",
            title: "Quarterly update",
            onError: function (err) { status.textContent = "Failed: " + err.message; }
        }).then(function (name) {
            status.textContent = "Downloaded " + name;
        }).catch(function () { /* handled in onError */ });
    }
</script>