Skip to content

Latest commit

 

History

History
104 lines (72 loc) · 4.18 KB

File metadata and controls

104 lines (72 loc) · 4.18 KB

Export to Word plugin

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

liveDemo::exportword[]

Note
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 using the {companyname} Cloud service

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',
  // 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

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:
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/.

Additional Configuration

Commands

The Export to Word plugin provides the following {productname} commands.

API Reference

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