CLOSED: [2017-12-17 Sun 17:24] SCHEDULED: <2017-12-17 Sun> :PROPERTIES: :ID: 2017-12-17-pandoc-docx-reference :CREATED: [2017-12-17 Sun 17:08] :END: :LOGBOOK: - State "DONE" from "NEXT" [2017-12-17 Sun 17:24] :END: Silent update 2019-09-25: added to [[id:2019-09-25-using-orgmode][blog series "Using Org Mode Features"]] Please do read [[id:2019-09-25-using-orgmode][my "Using Org Mode Features" (UOMF) series page]] for explanations on articles of this series. The amazing [[https://twitter.com/pdfkungfoo][@pdfkungfoo]] tweeted about a nice feature of [[https://en.wikipedia.org/wiki/Pandoc][Pandoc]], the universal document conversion tool: #+CAPTION: Tweet by pdfkungfoo mit Hinweis auf docx-Vorlagen für pandoc. #+ATTR_HTML: :alt 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! #+ATTR_HTML: :align center :width 588 [[tsfile:2017-10-30T14.56 Twitter.com - pdfkungfoo - pdfkungfu mit Hinweis auf pandoc input --reference-docx -- screenshots publicvoit.png][https://twitter.com/pdfkungfoo/status/924998503113388032]] According to [[https://pandoc.org/MANUAL.html#options-affecting-specific-writers][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: 1. the current folder OR 2. a folder which is defined by =--data-dir= OR 3. the system default folder for =data-dir= which is - =$HOME/.pandoc= on UNIX-like systems - =C:\Documents And Settings\USERNAME\Application Data\pandoc= 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 [[id:tags-emacs][Emacs Org-mode]] to a =docx= file (via [[https://github.com/kawabata/ox-pandoc][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. The only thing left is that I do have to learn how to avoid Emacs opening the resulting =docx= file as ZIP file in a buffer instead of opening it in Word.