How to export html from emacs org-mode that can be opened in Microsoft Word
I created an HTML file using Emacs (org-mode export), which I want to open in Microsoft Word. However, Word says it cannot open the file. In the details of the error message, it says:
Reference to undefined entity 'hellip'.
For lack of a better fix, I go in to the file and replace all occurrences of "&hellip ;" with "...", but then I get a similar error message for 'nbsp', and so on.
What is the simplest way to get emacs to output an org-mode file in a form that can be opened in Microsoft Word, without losing formatting?
There are many ways to do this, since org-mode supports so many different formats, and tools like pandoc converts among most of these formats.
I am not sure of the simplest way, and I had some odd results with the direct org -> docx conversion in pandoc, i.e. pandoc -s myfile.org -o myfile.docx
, but there are still plenty of other options.
One approach starting with the .html export is to open the file in a browser and then copy-paste the contents to word. This preserves formatting. Another approach, described on the org-mode mailing list involves deleting the all xml lines at the top of the .html file at the top until the first line is the <html>
tag.
As mentioned in a comment, you can also export to .odt (the open office writer format). This does not require an installation of OpenOffice. I just tried it with MS Word 2013. Although I got an error that said the file could not open because of an unspecified error in content.xml line 261
, it was able to recover from the error and convert the .odt file to word, preserving formatting.