Silent update 2019-09-25: added to blog series "Using Org Mode Features"

Please do read my "Using Org Mode Features" (UOMF) series page for explanations on articles of this series.

The amazing @pdfkungfoo tweeted about a nice feature of Pandoc, the universal document conversion tool:

Lade das Vorlagen-Muster in Word (.dot / .docx -- egal), mache evtl. gewünschte Anpassungen an'n Stilen + speicher's als DOCX (nicht DOT) unter "my-reference.docx". Dann:



#pandoc input --reference-docx=my-reference.docx -o out.docx



Wirklich erstaunlich, wie viel da geht! — pdfkungfoo (@pdfkungfoo) October 30, 2017

According to the manual, the option "--reference-doc=FILE" may define a docx (Word) or odt (LibreOffice) document which is used as a format template file.

So if you do have a company template for arbitrary Word files, you could use it as a template for your export. Copy a docx file (not a dotx template) as reference.docx to either:

the current folder OR a folder which is defined by --data-dir OR the system default folder for data-dir which is $HOME/.pandoc on UNIX-like systems

on UNIX-like systems C:\Documents And Settings\USERNAME\Application Data\pandoc on Windows XP you should not use any more

on Windows XP you should not use any more C:\Users\USERNAME\AppData\Roaming\pandoc on Windows Vista or later.

So I took a company docx , renamed it to reference.docx and copied it to C:\Users\USERNAME\AppData\Roaming\pandoc on my Windows 10. When I now export from my Emacs Org-mode to a docx file (via ox-pandoc), I get documents that follow the style of our company documents: fonts, font colors, and even the company logo.

Awesome and nifty feature.