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 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
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
|
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: 'http://localhost:8080/' // update to your own self-hosted service URL
});
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/ .
|
Options
The following configuration options affect the behavior of the Export to Word plugin.
exportword_service_url
The Export to Word uses the HTML to DOCX converter service to generate the Word files.
The Export to Word feature is currently only available exclusively for on-premise
setups, requiring a self-hosted HTML to DOCX converter service and the exportword_service_url
option to be properly configured. If you require access to this feature, please contact us. Refer to our on-premises documentation for detailed instructions on deploying the Export to Word service server-side component using Docker.
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
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: {
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"
}
},
},
});
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 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
tinymce.init({
selector: 'textarea.tinymce',
plugins: 'exportword',
toolbar: 'exportword',
exportword_service_url: '<service_URL>', // required
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
});
Commands
The Export to Word plugin provides the following TinyMCE commands.
Command | Description |
---|---|
ExportWord |
Uses |
tinymce.activeEditor.execCommand('ExportWord');
API Reference
Explore the comprehensive API documentation for the Export to Word Premium plugin at Export to Word.