To convert docx to html , one would doword = wc.Dispatch("Word.Application")doc = word.Documents.Open(docx_path)doc.SaveAs(html_path, 8)But here we require paths. I am using python-docx-template . I read a docx file, template it, then save to a StringIO(). But now I have to first save the doc as .
class PrepMessage:
def __init__(self):
self.msg = EmailMessage()
self.templates = {}
def _get_template(self, template_path):
try:
return copy.deepcopy(self.templates[template_path])
except KeyError:
with open(template_path, "rb") as