Search code examples
pythonhtmlms-word

Python convert word to html


I'd need to convert a .docx file with colored words into html. I've tried the mammoth library but the colors are lost. How could I achieve my goal?


Solution

  • import win32com.client
    doc = win32com.client.GetObject("demo.docx")
    doc.SaveAs (FileName="hey.html", FileFormat=8)
    doc.Close ()