Export to Word

This plugin is only available as a paid add-on to a TinyMCE subscription.
This feature is only available for TinyMCE 7.0 and later.

The export to Microsoft Word feature collects the HTML generated with the tinymce.editor.getContent() method and combines it with the default editor content styles along with the styles provided in the configuration. The combined content and styles are then transmitted to the TinyMCE Cloud Services HTML to DOCX converter service. Following this, the service generates a Word file, which is subsequently returned to the user’s browser, enabling them to save it in the Word format onto their disk.

Interactive example

Export to Word demo

Demos containing the Export to Word plugin are currently only available on our main website. Check out the Export to Word demo, or the demo on our home page, to try it out today.

Export to Word known issues
  • The generated .docx file may not be fully compatible with older versions of Word.

  • Enhanced Media Embed will not be included in the exported document, resulting in a console.error "The Export to Word plugin requires the exportword_service_url to be configured".

Basic setup

To add the Export to Word plugin to the editor, add exportword to the plugins option in the editor configuration.

For example:

tinymce.init({
  selector: 'textarea',
  plugins: 'exportword',
  toolbar: 'exportword',
  exportword_service_url: '<service_URL>'
});

Options

The following configuration options affect the behavior of the Export to Word plugin.

exportword_service_url

The Export to Word uses the TinyMCE Cloud Services HTML to DOCX converter service to generate the Word files.

The Export to Word feature is currently only available on-premise and requires the exportword_service_url option to be configured. Contact us if you require this feature.

Type: String

Example: using exportword_service_url

tinymce.init({
  selector: 'textarea',
  plugins: 'exportword',
  toolbar: 'exportword',
  exportword_service_url: '<service_URL>'
});

exportword_converter_options

The exportword_converter_options option, is used to specify and configure various options related to the process of converting and exporting content from the editor to .docx Word file.

Type: Object

Default value: {}

Example: using exportword_converter_options

tinymce.init({
  selector: 'textarea',
  plugins: 'exportword',
  toolbar: 'exportword',
  exportword_service_url: '<service_URL>',
  exportword_converter_options: {
    header: [
      {
        html: '<h1>First page header.</h1>', //example
        css: 'h1 { font-size: 30px; }', //example
      }
    ],
  },
});
To use this option, the Export to Word plugin requires the exportword_service_url option to be configured.

For comprehensive details regarding the exportword_converter_options, please refer to the API documentation available for the Export to Word Premium plugin.

exportword_converter_style

The exportword_converter_style option allow for customization of the styles applied to the exported Word document, providing flexibility in controlling its appearance.

Type: String

Default value: ''

Example: using exportword_converter_style

tinymce.init({
  selector: 'textarea.tinymce',
  plugins: 'exportword',
  toolbar: 'exportword',
  exportword_service_url: '<service_URL>', // required
  exportword_converter_options: { // required to support "exportword_converter_style"
    header: [
      {
        html: '<h1>First page header.</h1>', //example
        css: 'h1 { font-size: 30px; }', //example
      }
    ],
  },
  exportword_converter_style: 'p { color: cyan !important }'
});

Commands

The Export to Word plugin provides the following TinyMCE commands.

Command Description

ExportWord

Uses editor.getContent() and generates a new document.docx Word file that can be saved to local disk.

Examples
tinymce.activeEditor.execCommand('ExportWord');

API Reference

Explore the comprehensive API documentation for the Export to Word Premium plugin at Export to Word.