DEV Community

Discussion on: How do you ensure consistent formatting in MS Word?

stereoplegic profile image
Mike Bybee

Yes, styles and choosing the appropriate elements is key to getting any consistency whatsoever.

What I've found helps is to start my document in markdown, and convert it to two files using pandoc. The first one will serve as your template for the second pandoc conversation. I use the exact same source markdown, so I can predict how the finished product will look with proper font sizes, styles, and margins as much as possible (all tweaked in the Word/LibreOffice styles pane of the first output template file).

Then, when I'm finished writing my markdown, I fire a second pandoc command of:

pandoc -t docx --reference-doc=path-to-your-file/reference.docx -o file-name.docx