import pypandoc
output = pypandoc.convert_file('file.html', 'docx', outputfile="file1.docx")
assert output == ""
It is generating new docx file but ignoring styles.
Can any one tell me how to generate new docx file with styles?
Thanks in advance for your answers.
You will need to use Microsoft Word to perform this process; luckily, Word will automatically convert an HTML document into its web page format when you open the HTML document in Word.
You can also use htmldocx in python 3.x:
from htmldocx import HtmlToDocx
new_parser = HtmlToDocx()
new_parser.parse_html_file("html_filename", "docx_filename")
#Files extensions not needed, but tolerated
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With