Creating a DOCX file from an AsciiDoc file

Create a DOCX file for Microsoft Word and LibreOffice from an AsciiDoc file directly in the IDE.

This feature is available since plugin version 0.37.26.

The user can choose Create DOCX from current file from the editor’s action toolbar to convert the current file to the DOCX format. If creation of the DOCX file succeeds, the exported file is opened in the system’s default application, for example, Microsoft Word or LibreOffice.

Downloading Pandoc

The conversion is done using Pandoc. On first use the plugin downloads a version of Pandoc that is compatible with the plugin.

Specifying a format template

If the plugin finds a file named reference.docx in the current project, it will use that as a template for formatting styles of the generated document. Users can download this template and modify it for their needs. See the Pandoc manual section about the reference file for more details.

Automation on the command line

The conversion the plugin performs has two steps:

  1. Convert the AsciiDoc file to DocBook using the Asciidoctor DocBook backend.

  2. Convert the DocBook output to DOCX using Pandoc.

How this can be automated on the command line shows the following example:

Example without a reference file
# convert AsciiDoc 'my-document.adoc' to DocBook 'my-document.xml'
asciidoctor -b docbook my-document.adoc
# convert DocBook 'my-document.xml' to DOCX 'my-document.docx'
pandoc -r docbook -t docx -o my-document.docx my-document.xml
Example with a reference file
# convert AsciiDoc 'my-document.adoc' to DocBook 'my-document.xml'
asciidoctor -b docbook my-document.adoc
# convert DocBook 'my-document.xml' to DOCX 'my-document.docx'
pandoc -r docbook -t docx -o my-document.docx --reference-doc=reference.docx my-document.xml