Style in HTML

Hello,


I'm using .AppendHTML to append an HTML string to a paragraph. This is the sample HTML string:


Sample <i><strong>text</strong></i><strong> </strong>in <span style="color: rgba(230, 76, 76, 1)">red<sup>2</sup></span>


However the word "red" is not in red; in other words, it seems that the style attribute is not considered. When will you add support for it?

Thanks!


2 Replies

PA Paolo December 2, 2021 06:45 PM UTC

Another thing: why if I use the following HTML string with .AppendHTML


Sample image: <img src=\"https://www.clipartmax.com/png/full/138-1388050_formula-clipart-free-for-download-b-square-root-b2-4ac-2a.png\" />


the image is not displayed in Word? Don't you support the IMG tag?

Thanks!



MR Manikandan Ravichandran Syncfusion Team December 3, 2021 10:32 AM UTC

Hi Paolo,

Thank you for contacting Syncfusion support.

Reg - Color issue
On further validating the reported color issue, we have found that when open the HTML file with RGBA color text in Microsoft Word application or when insert HTML text in Microsoft Word, the color is not preserved itself also. But, when open this HTML file in Web browser, the color is applied. So, this is not an issue and it is Microsoft Word Viewer behaviour.

If you want to apply color to the text, you can use RGB color code instead of RGBA color code which is preserved properly in Microsoft Word application and in Web browser.

Please refer the attached video for more reference.
https://www.syncfusion.com/downloads/support/forum/170890/ze/RGBAColorIssue-848646550

Reg – Image issue:
To preserve image from URL when insert the HTML in Docx document in .net core platform, you should call the ImageNodeVisited event in DocIO.

Please refer the below link to know more about ImageNodeVisited event.
https://help.syncfusion.com/file-formats/docio/html#customize-image-data
https://www.syncfusion.com/kb/12373/how-to-get-image-from-url-while-opening-html-in-asp-net-core

Please find the sample from the attachment.
https://www.syncfusion.com/downloads/support/forum/170890/ze/ConsoleApp3.1_F170890161444541

Please let us know if you have any other queries.

Regards,
Manikandan Ravichandran 


Loader.
Up arrow icon