[python-win32] Use of streams than path in `wc.Dispatch("Word.Application").Documents.Open(docx_path)

2021-03-13 Thread manglavishesh64
 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 .

Re: [python-win32] Use of streams than path in `wc.Dispatch("Word.Application").Documents.Open(docx_path)

2021-03-13 Thread Vishesh Mangla
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