html-to-docx icon indicating copy to clipboard operation
html-to-docx copied to clipboard

bug: when an image is nested under spans, xml-builder doesn't pick up the img tag

Open nicolasiscoding opened this issue 1 year ago • 1 comments

In the following scenario, the image will not render properly.

<p><span style="font-size: 11pt;"><span style="font-family: Calibri,sans-serif;"><span style="font-size: 12.0pt;"><span style="color: black;"><img src="shortenedbase64string"></span></span></span></span></p>

After triaging, it can be as simple as checking for a vNode here: https://github.com/privateOmega/html-to-docx/blob/2ae805da708e2b3c332cacfe63d0fc55b1c06c89/src/helpers/xml-builder.js#L584

but wanted input on the best way to do this to handle more cases.

Locally, I added another "else if" for this use case and ran the buildImage function. It worked as expected in office for desktop, but did not work for libre. Not an urgent bug as we found a workaround but wanted to add the repro steps here.

nicolasiscoding avatar Jan 07 '24 21:01 nicolasiscoding