ExportWordConfig (export-word)



The configuration of the export to Word feature. It is used by the Word export features from the @ckeditor/ckeditor5-export-word package.

	.create( editorElement, {
		exportWord: ... // Export to Word feature options.
	} )
	.then( ... )
	.catch( ... );

See all editor options.



  • converterOptions : Object

    The CKEditor Cloud Services HTML to DOCX Converter configuration options.

    NOTE: Configuring the plugin is not mandatory.

    const exportWordConfig = {
    	converterOptions: {

    Defaults to:

    	fileName: 'document.docx',
    	converterUrl: '',
    	converterOptions: {
    		format: 'A4',
    		margin_top: '1in',
    		margin_bottom: '1in',
    		margin_right: '1in',
    		margin_left: '1in',
    		header: undefined,
    		footer: undefined,
    		comments: undefined,
    		suggestions: undefined
  • converterUrl : String

    A URL to the Docx converter.

    const exportWordConfig = {
    	converterUrl: ''

    NOTE: The plugin uses the default HTML to Word converter delivered by CKEditor Cloud Services. You can provide a URL to an on-premises converter instead.

    Defaults to

  • dataCallback : function

    A function to gather the HTML to be converted to Word.

    NOTE: This option may be useful when the editor does not have a getData() method, or if the HTML to be converted should be different than the edited one.

    const exportWordConfig = {
    	dataCallback: ( editor ) => {
    		return `
    			<header id="header">${ { rootName: 'header' } ) }</header>
    			<div id="content">${ { rootName: 'content' } ) }</div>

    Defaults to

    ( editor ) => editor.getData( { pagination: true } )

    If using the pagination feature, the pagination:true option inserts additional markers into editor's data. Thanks to that, the Docx converter creates a Word document similar to what is displayed in the editor.


    editor : Editor

    The editor instance.

  • fileName : String

    The name of the generated Word file.

    const exportWordConfig = {
    	fileName: 'my-document.docx'

    NOTE: The file name must contain the .docx extension. Otherwise your operating system or device may have trouble identifying the file type.

    Defaults to document.docx.

  • stylesheets : Array.<String>

    Paths to the .css files containing additional styling for the editor's content (the order of provided items matters).

    const exportWordConfig = {
    	stylesheets: [ './path/to/custom-style.css' ]

    NOTE: If stylesheets are not provided, the plugin will sent only the default editor content styles to the converter.

    Default editor's content styles: The default editor content styles are applied to the generated Word file thanks to the 'EDITOR_STYLES' token, which is provided to the stylesheets by default. If you don't want them to be applied, you have to omit the token:

    const exportWordConfig = {
    	stylesheets: [ './path/to/custom-editor-styles.css' ]

    Custom styling: For more advanced styling, your configuration should look like this:

    const exportWordConfig = {
    	stylesheets: [

    Defaults to [ 'EDITOR_STYLES' ].

  • tokenUrl : String | function | false

    A token URL or a token request function. This field is optional and should be used only when a different tokenUrl is required for the export to Word feature.

    Note: The token can be disabled with the false value provided.

    See: tokenUrl