Control DOCX export

Download an edited DOCX, return its bytes, or package related files.

Export the document you have edited, then choose what your application does with the file. The browser Editor exports DOCX; it does not convert the document to PDF or HTML through this method.

Use the running Editor from the Quickstart. The examples below belong in your export button's handler, after onReady. Keep the button disabled while export is running and show any rejected promise as an error.

In Vanilla, superdoc is the instance you created. In React, obtain it inside the handler before using any example:

const superdoc = editorRef.current?.getInstance();
if (!superdoc) return;

Download the edited document

await superdoc.export({ exportedName: 'sample-edited' });

This starts a download named sample-edited.docx. Open it and confirm that your edit is present. The filename does not need an extension, and DOCX is already the default format.

For a runnable save, edit, restore, and export flow, use the version-history example. Its Export current DOCX button downloads the document currently open in the Editor.

Return bytes without downloading

Set triggerDownload: false when your application needs the file instead of a browser download:

const docx = await superdoc.export({ triggerDownload: false });

For one document without additional files, the result is a DOCX Blob. Export does not upload it or confirm a save. Use the Load and save guide to send those bytes to your backend and report success only after storage confirms the write.

Check comments and tracked changes

Export preserves comments by default. The Quickstart's default v2 worker runtime does not support commentsType: 'clean': export rejects instead of returning a copy without comments.

If you need final text, finish the review workflow before exporting. The v2 Editor does not apply isFinalDoc during export; do not use that option as a review decision.

To deliver the DOCX alongside another file, supply a Blob and its filename. This example creates its own small metadata file; it does not require an audit service:

const metadata = new Blob([JSON.stringify({ document: 'sample-edited' })], { type: 'application/json' });

const bundle = await superdoc.export({
  exportedName: 'sample-edited',
  additionalFiles: [metadata],
  additionalFileNames: ['metadata.json'],
  triggerDownload: false,
});

The result is a ZIP Blob containing sample-edited.docx and metadata.json. Keep the two additional-file arrays in the same order, with one filename for each file. Omit triggerDownload: false to download sample-edited.zip.

Choose options for the next export

OptionDefaultEffect
exportedNameEditor titleName the DOCX or ZIP without its extension.
triggerDownloadtrueDownload the result; set it to false to return a Blob or ZIP without downloading.
commentsType'external'Preserve comments. The default v2 worker runtime rejects 'clean'.
additionalFiles / additionalFileNamesEmpty arraysInclude related files in a ZIP.

exportType defaults to ['docx'], the browser Editor's supported export format. The v2 Editor does not apply fieldsHighlightColor during export.

Use Version history when your application needs to retain each exported DOCX as a saved version.

On this page