0

I'm writing a python script and i have to convert a rendered string(from a json with html inside) to a .docx file. I searched a lot in web but I'm still confused. I tried with python-docx but doesn't work well because wants docx input and he doesn't like this as a string:

<h1><span lessico='Questa' idx="0" testo="testo" show-modal="setModal()"     tables="updateTables(input)">Questa</span> <span lessico='&egrave;' idx="1" testo="testo" show-modal="setModal()" tables="updateTables(input)">&egrave;</span> <span lessico='una' idx="2" testo="testo" show-modal="setModal()" tables="updateTables(input)">una</span> <span lessico='domanda' idx="3" testo="testo" show-modal="setModal()" tables="updateTables(input)">domanda</span>...</h1>

<ul>

 <li>a scelta multipla</li>

 <li>con risposta aperta</li>

 <li>di tipo trova</li>

 <li>di associazione</li>

How can i convert this into a formatted .doc or .docx? possibly without getting mad :)

JungleFever
  • 47
  • 2
  • 11
  • Possible duplicate of https://stackoverflow.com/questions/4226095/html-to-doc-converter-in-python – damisan Aug 25 '17 at 10:57
  • pywin32 is only for windows, and works bad, I'm hoping for something better :) – JungleFever Aug 25 '17 at 11:01
  • What is it you want to achieve? Creating a Word document (.docx)? Or do you have a HTML form that has to be converted? Looks like you want to write a HTML to Word converter, which will involve maybe not getting mad :-) but some programming. If you can provide more background, people can help you better. – Arminius Aug 25 '17 at 11:41
  • Yes, I need to create a converter, the output must be a .docx file, from a rendered string, for the pdf version I used weasyprint and all worked fine. The string is rendered from a json with html inside it. – JungleFever Aug 25 '17 at 16:21

0 Answers0