---
title: "Export to Word plugin"
description: "The Export to Word feature lets you generate a .docx (Microsoft Word document) file directly from the editor."
canonical_url: "https://www.tiny.cloud/docs/tinymce/latest/exportword/"
md_url: "https://www.tiny.cloud/docs/tinymce/7/exportword/index.md"
version: "7"
last_updated: "2026-05-24T22:44:41Z"
tokens: 2645
---
Important This page documents TinyMCE 7. For new projects, Tiny recommends using the latest, most up-to-date version. [See TinyMCE 8 documentation](../../latest/exportword/).
# Export to Word plugin

> **Note:** This plugin is only available as a [paid add-on](/tinymce/features/export-word/) to [a TinyMCE subscription](/pricing).

> **Note:** 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 plugin configuration. The combined content and styles are then processed by the included server-side converter service, which can be either self-hosted or cloud-based. Following this processing, a Word file is generated, which is subsequently returned to the user’s browser, enabling them to save it in the Word format onto their disk or drive.

## Interactive example

**Example**

```js
tinymce.init({
  selector: 'textarea#exportword',
  height: '800px',
  plugins: [
    "exportword", "advlist", "anchor", "autolink", "charmap", "code", "fullscreen",
    "help", "image", "insertdatetime", "link", "lists", "media",
    "preview", "searchreplace", "table", "visualblocks",
  ],
  toolbar: "undo redo | exportword | styles | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
  exportword_converter_options: {
    document: {
      size: 'A4',
      margins: {
        top: "1in",
        bottom: "1in",
        left: "1in",
        right: "1in"
      }
    },
    watermark: {
      source: 'http://moxiecode.cachefly.net/tinymce/v9/images/logo.png',
      washout: true
    },
  }
});
```

> **Note:** Export to Word known issues
> - The generated `.docx` file may not be fully compatible with older versions of Word.
> - [Enhanced Media Embed](../introduction-to-mediaembed/) 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 using the Tiny Cloud service

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

For example:

```js
tinymce.init({
  selector: 'textarea',
  plugins: 'exportword',
  toolbar: 'exportword',
  // Required for the cloud-based Export to Word plugin with Tiny Cloud
  // Create a JWT key in the Customer Portal for trial functionality to enable watermark-free exports during the trial period
  exportword_token_provider: () => {
    return fetch('http://localhost:3000/jwt', { // specify your token endpoint
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
    }).then(response => response.json());
  },
});
```
For more infomation on the exportword_token_provider option, see [exportword_token_provider](#exportword-token-provider)

> **Important:** The Export to Word plugin **requires** JWT authentication when using the Tiny Cloud service.
> 
> **Authentication Setup:**
> 
> 1. Create a JWT key in the Customer Portal
> 2. Configure the `exportword_token_provider` option to specify the endpoint for retrieving your JWT token
> For more information on how to set up JWT authentication with Export to Word, see examples: [Export to Word with JWT authentication (Node.js)](../export-to-word-with-jwt-authentication-nodejs/) or [Export to Word with JWT authentication (PHP)](../export-to-word-with-jwt-authentication-php/)
> 
> **Trial period behavior**
> 
> - **Trial Period:**
> 
> - With JWT: Full functionality, unlimited usage, no watermarks.
> - Without JWT: Full functionality with watermarks.
> - **After Trial:**
> 
> - With Export to Word add-on + JWT: Full functionality (subscription-based)
> - Without add-on: Plugin entitlements are `disabled` and functionality is no longer available.
> Visit the [account portal](/auth/login/) to obtain your JWT key and test full functionality.

## Basic setup using the self-hosted service

To use the self-hosted version of the Export to Word plugin, you need to set the `exportword_service_url` option to the URL of the service.

Example:
```js
tinymce.init({
  selector: 'textarea',
  plugins: 'exportword',
  toolbar: 'exportword',
  exportword_service_url: 'http://localhost:8080/' // Update with the URL of the service you are using such  as 'http://myserver.com/'
});
```

> **Important:** The `exportword_service_url` option automatically appends `/v2/convert/html-docx` to the URL provided, so only the base URL is required. For example, if the service is hosted at `http://localhost:8080/v2/convert/html-docx`, the `exportword_service_url` option should be set to `http://localhost:8080/`. When using in production, ensure that `exportword_service_url` is updated to the production URL such as `https://myserver.com/`.

## Options

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

### `exportword_service_url`

The Export to Word plugin uses an HTML-to-DOCX converter service to generate Word files.

This option is **required** when configuring the Export to Word plugin for `on-premise` setups. If you require access to this feature, please [contact us](/contact/). For detailed instructions on deploying the Export to Word service server-side component using Docker, refer to the [on-premises documentation](../individual-import-from-word-and-export-to-word-on-premises/).

> **Tip:** When using a custom host, set the `exportword_service_url` option in your TinyMCE configuration to match your host. For example, if your custom host is `mycustomhost.com`, set the URL to `https://mycustomhost.com/`.
**Type:** `String`

#### Example: Setting up `exportword_service_url`

```js
tinymce.init({
  selector: 'textarea',
  plugins: 'exportword',
  toolbar: 'exportword',
  exportword_service_url: '<service_URL>' // required for On-premise setups only
});
```

### `exportword_token_provider`

The `exportword_token_provider` option enables integration with a token-based authentication service for exporting Word documents. It provides a mechanism to fetch an authentication token from a specified endpoint. This ensures that the export process can securely communicate with the server.

**Type:** `Function`

**Default value:** `undefined`

**Return data:** [`Token` object](#data-structure)

#### Example: using `exportword_token_provider`

```js
tinymce.init({
  selector: 'textarea',
  plugins: 'exportword',
  toolbar: 'exportword',
  exportword_token_provider: () => { // required when using the Export to Word plugin with Tiny Cloud.
    return fetch('http://localhost:3000/jwt', { // specify your token endpoint
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
    }).then(response => response.json());
  },
});
```

#### Data structure for the JWT token

The object containing the valid encoded token must match the following structure:

```js
{
  token: "<encoded JWT string>"
}
```

| Field | Type | Required? | Description |
| --- | --- | --- | --- |
| `token` | `string` | required | A Base64-encoded JSON Web Token (JWT) used for authentication and authorization. |

### `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`

> **Note:** As of TinyMCE 7.5.0, the default value of the `exportword_converter_options` setting has been updated to the following:
**Default value:**
```js
exportword_converter_options: {
  document: {
    size: 'letter'
  }
}
```

#### Example: using `exportword_converter_options`

```js
tinymce.init({
  selector: 'textarea',
  plugins: 'exportword',
  toolbar: 'exportword',
  exportword_service_url: '<service_URL>', // required if using On-premises service
  exportword_converter_options: {
    headers: {
      first: {
        html: "<p>My document header</p>",
        css: "p { color: gray; }"
      },
      default: {
        html: "<p>My default header</p>",
        css: "p { color: blue; }"
      }
    },
    footers: {
      odd: {
        html: "<p>My odd footer</p>",
        css: "p { font-size: 10px; }"
      },
      even: {
        html: "<p>My even footer</p>",
        css: "p { font-size: 12px; }"
      }
    },
    document: {
      orientation: "landscape",
      size: "a3",
      margins: {
        top: "10mm",
        bottom: "10mm",
        left: "20mm",
        right: "15mm"
      }
    },
  },
});
```

> **Note:** 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](https://exportdocx.api.tiny.cloud/v2/convert/docs#section/Export-to-Word) available for the Export to Word Premium plugin.

### `exportword_converter_style`

The `exportword_converter_style` option allows for customization of the styles applied to the exported Word document, providing flexibility in controlling its appearance; however, this option does **not affect** the distinct styling of the `header` and `footer`.

**Type:** `String`

**Default value:** `''`

#### Example: using `exportword_converter_style`

```js
tinymce.init({
  selector: 'textarea.tinymce',
  plugins: 'exportword',
  toolbar: 'exportword',
  exportword_service_url: '<service_URL>', // required if using On-premises service
  exportword_converter_options: {
    headers: {
      first: {
        html: "<p>My document header</p>",
        css: "p { color: gray; }"
      },
      default: {
        html: "<p>My default header</p>",
        css: "p { color: blue; }"
      }
    },
  },
  exportword_converter_style: 'p { color: cyan !important }' // will override the set <p> tag styles in the HTML content
});
```

### `watermark`

The `watermark` option provides integrators with a way to include semi-transparent image watermarks on each page of the exported document, which can be useful for branding, copyright protection, or decorative purposes.

**Type:** `Object`

#### Example : using `watermark`

```js
tinymce.init({
  selector: "textarea",
  plugins: ['exportword'],
  toolbar: 'exportword',
  exportword_converter_options: {
    watermark: {
      source: 'https://<your domain>/some-image.png',
      washout: true,
    }
  }
});
```

> **Note:** The `exportword_converter_options` is required to use the watermark feature.

## 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
```js
tinymce.activeEditor.execCommand('ExportWord');
```

## API Reference

> Explore the comprehensive API documentation for the Export to Word Premium plugin at [Export to Word API Reference Documentation.](https://exportdocx.api.tiny.cloud/v2/convert/docs#section/Export-to-Word)
