How to generate Microsoft Word documents using Sphinx

Andrea Francia picture Andrea Francia · May 13, 2009 · Viewed 12.1k times · Source

Sphinx supports a few output formats:

  • Multiple HTML files (with html or dirhtml)
  • Latex which is useful for creating .pdf or .ps
  • text

How can I obtain output in a Microsoft Word file instead?

With another doc generator I managed to generate a single html output file and then convert it to Microsoft Word format using the Word application.

Unfortunately I don't know a way to generate either Word or the HTML single-page format.

Answer

frogcoder picture frogcoder · Dec 6, 2017

The solution I use is singlehtml builder like andho mentioned in the comment, then convert the html to docx using pandoc. The following sample assumes the generated html would be located at _build/singlehtml/index.html

make singlehtml
cd _build/singlehtml/
pandoc -o index.docx index.html