Export to Word - quick start

This article aims to get you up and running with the Export to Word feature in your CKEditor Premium Features free trial.

Follow the steps below:

# Subscribe to the CKEditor Premium Features free trial

Create an account by signing up for CKEditor Premium Features free trial. After signing up, you will receive access to the customer dashboard (CKEditor Ecosystem dashboard).

CKEditor Premium Features free trial sign-up view.

You will be asked to check the features you are most interested in.

Checking these features does not affect the trial bundle contents — all the features will be available regardless of the choice. We just want to know your needs better.

# Log in to the CKEditor Ecosystem dashboard

Log in to the CKEditor Ecosystem dashboard. You will receive a confirmation email and will be asked to create a password for your account. Keep it safe.

# Account dashboard

After logging in, click “CKEditor” under the “Your products” header on the left. You will see the subscription parameters overview together with the management area below.

Your CKEditor trials view in the customer dashboard.

# Creating token endpoint

Before you can use your newly activated CKEditor Premium Features free trials bundle, you first need to create a security token endpoint in your application. The role of this endpoint is to securely authorize end users of your application to use CKEditor Cloud Services only if they should have access to the content or action they are requesting.

# Development token endpoint (fast and easy)

If you are just starting, you may use the development token endpoint URL which is available out of the box and requires no coding on your side. The URL of the development token endpoint can be obtained easily in three simple steps:

  1. To work with CKEditor Premium Features like export to Word, you need to create an environment. Environments allow you to create access credentials, manage webhooks, configure features and connect to CKEditor Cloud Services. You may have more than one environment to serve separate instances or integrations. From the list of environments choose the one that you want to manage.

    Environments list.

    Please refer to the the environment management guide if needed.

  2. After choosing the environment, press the “Generate” button in the “Development token URL” section of the “CKEditor configuration” tab:

    Press the button to generate the development token URL.

    The development token URL will show up in the “Development token URL” section:

    CKEditor configuration with the development token URL.

    The development token endpoint is a special endpoint to help you in getting started with CKEditor Cloud Services. It offers unrestricted, full access to the service and will expire 30 days after being used for the first time. You should not use it in production. Anyone knowing this URL will have full access to the associated environment.

# Writing your token endpoint (advanced users)

Skip this step if you use the development token endpoint.

To write your own security token endpoint, you need to create access credentials for the selected environment by going to the “Access credentials” tab and clicking the “Create a new access key” button.

Read more in the Creating access credentials section of the Environments management guide.

# Integrating the Export to Word feature with CKEditor 5

To install the plugin into your WYSIWYG editor, use the online builder to generate a custom CKEditor 5 build with the plugin enabled. Alternatively, refer to the installation guide in the plugin documentation to do it on your own.

Configure the plugin using the token generated earlier, pasting the link in the configuration:

import { ClassicEditor } from 'ckeditor5';
import { ExportWord } from 'ckeditor5-premium-features';

ClassicEditor
    .create( document.querySelector( '#editor' ), {
        plugins: [ ExportWord, /* ... */ ],
        toolbar: [ 'exportWord', '|', /* ... */ ],
        exportWord: {
            tokenUrl: 'https://example.com/cs-token-endpoint',
            fileName: 'my-file.docx',
            converterOptions: {
                format: 'A4', // Default value, you do not need to specify it explicitly for A4.
                margin_top: '20mm',
                margin_bottom: '20mm',
                margin_right: '12mm',
                margin_left: '12mm'
            }
        }
    } )
    .then( /* ... */ )
    .catch( /* ... */ );

This is all. At this point, the export to Word feature will be automatically enabled in your application. Visit the CKEditor 5 export to Word plugin guide for more details on these configuration options.

# Using the REST API service

Refer to the Export to Word guide to get in-depth information about the feature and available options.