Open jacovanderlaan opened 7 months ago
Hello! Is your question regarding italics or underlining? I want to improve this functionality. If you're referring to underlining, based on my tests, it works as expected. I can provide you with a code example that might help! Let me know how I can assist further. from docx import Document from htmldocx import HtmlToDocx
document = Document() html_parser = HtmlToDocx()
html_content = ''' <!DOCTYPE html>
This is a sample text with underlined words.
Here is another line with multiple underlined words in a sentence.
'''
html_parser.add_html_to_document(html_content, document) document.save('output_with_underline.docx') print("HTML to DOCX conversion complete!")
you can try the code below!
from docx import Document from htmldocx import HtmlToDocx
document = Document() html_parser = HtmlToDocx()
html_content = ''' <!DOCTYPE html>
This is underlined and italic text.
Here is a combination of underlined and italic text.
'''
html_parser.add_html_to_document(html_content, document) document.save('output_with_underline.docx') print("HTML to DOCX conversion complete!")
Hi there,
The html2doc module works perfect for me, manu thanks for it. There is just one issue I do not get to work and that is the conversion of italic. Below is a HTML section with text-decoration:underline. Any idee why this is not converting into a underline property in python-docx?
Thx!
jaco
BDV: