I’m creating a docx file from an HTML page using pandoc, but for the life of me I can’t seem to get it to take on any kind of styling or successfully use a dotx template. I don’t know if it’s because you can’t style docx files or I’m doing something wrong – documentation isn’t all that verbose for pandoc.
I’ve also tried just echoing the html out and setting headers so the client will open the file as a doc, but this has some problems when you save it (it will try to save as an html file and converting to a doc isn’t all that easy).
What I want to do is create an editable document which is styled and contains a logo image – just font types, colours and sizes would be enough, maybe some basic positioning would be nice.
Does anyone know how to acheive this on a LAMP – like system?
I stumbled on using Libreoffice on the CLI to do the conversion, with a much greater degree of success. It’s still not perfect but alot better than what I was getting, and seems to take onboard font types, sizes and colours alot better.
Steps to install and use (CentOS / Redhat here):
You may need some X11 / Xorg libs, easiest to just install Xorg if it won’t run.
Worked for me, I ended up with a serviceable .docx file which could be read by MS Word 2008 and LibreOffice 3.5.6.2.