html-to-docx
html-to-docx copied to clipboard
Multiple <span> underlined show errors
Thanks for this extremely useful library!
I found a problem while using, I have a paragraph of html that does not meet expectations in word, as follows:
html:
<p><span><span>This is an <u>underlined</u> text</span></span></p>
display in word:
This is an underlined text ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
if I remove the extra <span>, it is normal:
This is an underlined text ¯¯¯¯¯¯¯¯¯¯¯
but I can't do that, it was added by other class libraries.
@drawmoon Yes, this seems like a bug from html-to-docx itself, which I was able to reproduce, unfortunately my current bandwidth is very thin and wouldnt permit me to work on this at present and there are other things in list which has more priorirt.
I will keep this open so whenever I can, I will try to fix it whenever I get some time.
I hope as a temporary solution, you could make do with a regex replacement like this,
'<p><span><span>This is an <u>underlined</u> text</span></span></p>'.replace(/<span><span>/i, '<span>').replace(/<\/span><\/span>/i, '<span>')
This might be addressed in https://github.com/privateOmega/html-to-docx/pull/158
<p><span><span>This is an <u>underlined</u> text</span></span></p>
Yes it is, Thank you so much for this PR. Closing this since its addressed in v1.6.0