Import from Word plugin

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 Import from Word plugin lets you import .docx (Word document) or .dotx (Word template) files into the editor. The process preserves formatting and rich media.

Interactive example

Import from Word demo

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

Basic setup

To add the Import from Word plugin to the editor, add importword to the plugins option in the editor configuration.

For example:

tinymce.init({
  selector: 'textarea',
  plugins: 'code importword',
  toolbar: 'importword code',
  importword_service_url: '<service_URL>'
});

Options

The following configuration options affect the behavior of the Import from Word plugin.

importword_service_url option

This option is used for setting the URL endpoint for the conversion service.

If this string value is not configured it will return a console.error: The Import from Word plugin requires the importword_service_url to be configured. If the editor detects an invalid_URL, it will return a console.error: The value provided in importword_service_url is not a valid URL.

Type: String

Example: using importword_service_url

tinymce.init({
  selector: 'textarea',
  plugins: 'code importword',
  toolbar: 'importword code',
  importword_service_url: '<service-URL>'
});

Toolbar buttons

The Import from Word plugin provides the following toolbar buttons:

Toolbar button identifier Description

importword

Opens the import dialog so the user can select a specific .docx or .dotx file.

These toolbar buttons can be added to the editor using:

The Import from Word plugin provides the following menu items:

Menu item identifier Default Menu Location Description

importword

File

Opens the import dialog so the user can select a specific .docx or .dotx file.

These menu items can be added to the editor using:

Commands

The Import from Word plugin provides the following TinyMCE commands.

Command Description

ImportWord

Opens a file picker, that allows content from either a .docx or .dotx file to be imported into the editor.

Example
document.querySelector('button').addEventListener('click',
  () => tinymce.activeEditor.execCommand('ImportWord')
);
The ImportWord command cannot be directly invoked through a script at the top level or from the browser console. Instead, it necessitates a specific user action within the user interface, such as clicking a toolbar button. To ensure correct execution, the command should be called within the scope of an event handler tied to a specific user interaction, as shown in the example.

API Reference

Explore the comprehensive API documentation for the Import from Word Premium plugin at Import from Word.