I have the folllowing example:
from html4docx import HtmlToDocx
html = """
<table >
<tbody>
<tr >
<th style="border-top: 1px solid rgb(222, 222, 222)">
content
</th>
</tr>
</tbody>
</table>
"""
HtmlToDocx().parse_html_string(html)
It fails with
WARNING:root:Could not parse color 'rgb(222,': Invalid color value. Fallback to black.
When I change the border color to use rgb(222, 222, 222) everything works perfectly.
It is importation to mention, that border: 1px solid rgb(222, 222, 222) doesn't fail! But I don't think that it works corectly!
Maybe it's better to use an external library for css parsing. Unfortunately I found only one active CSS library: https://pypi.org/project/tinycss2/
I have the folllowing example:
It fails with
When I change the border color to use
rgb(222, 222, 222)everything works perfectly.It is importation to mention, that
border: 1px solid rgb(222, 222, 222)doesn't fail! But I don't think that it works corectly!Maybe it's better to use an external library for css parsing. Unfortunately I found only one active CSS library: https://pypi.org/project/tinycss2/