We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Rich text editor content to excel with same font display

I have code in C# to write values in worksheet. Source of the value is from Rich text editor which needs to be displayed on excel file but I am not able to display the exact view of the text. I have tried the following -

HTML String :  <p><span style=\"color: rgb(255, 0, 0); text-decoration: inherit;\">COLORED</span>TEXT</p>

  1. worksheet.Range[$"H12"].Text = value => gives me exact html code in sheet  <p><span style=\"color: rgb(255, 0, 0); text-decoration: inherit;\">COLORED</span>TEXT</p 
  2. worksheet.Range[$"H12"].HtmlString = value => gives me just text COLORED TEXT without the color
There is example to save html table but this is from richtexteditor and I have to fill one cell with the value, so need help with this. Thanks in advance.

5 Replies

VJ Vinitha Jeyakumar Syncfusion Team February 14, 2023 11:21 AM UTC

Hi Avinash,

By default, The content styles of Rich Text Editor are not returned while retrieving HTML value from the editor. So, the styles are not applied when using the HTML value outside of the editor. To get the styles to Rich Text Editor’s content for your application, You can copy and use the styles directly in your application. 

Note: Make sure to add a CSS class ‘e-rte-content’ to the content container.

Please check the below documentation for further information,


Regards,
Vinitha


AK Avinash Kumar replied to Vinitha Jeyakumar February 14, 2023 12:40 PM UTC

Hi Vinitha,


I am getting the values from react application in front end by richtexteditor and I don’t see these css classes applied in the content. As mentioned in my question I have values with property style and color set to red but when I add this content to excel I see only text.


I am using syncfusion xlsio for adding content to excel in backend C#.


I can see an example to insert html table values to excel in C# but not for the html content to worksheet range. Could you please provide an example for that similar to Importing HTML table to excel but it should be html content to excel worksheet range.


Thanks


VJ Vinitha Jeyakumar Syncfusion Team February 17, 2023 01:54 PM UTC

Hi Avinash,

We have considered the reported issue "Text color is missing while using RGB value in HTML string " as a bug from our end and the fix for the issue will be included with our upcoming patch release on 7th March 2023.

Now you can track the status of the reported issue through the feedback below,

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”


Regards,

Vinitha



VY Vinothkumar Yuvaraj Syncfusion Team March 15, 2023 02:31 PM UTC

Hi Avinash,


We are experiencing increased complexity in resolving the reported issue. Therefore, we will include the fix for the issue with our upcoming Volume 1 2023 release, which is expected to be rolled out by the end of March 2023.


Regards,

Vinothkumar



VY Vinothkumar Yuvaraj Syncfusion Team March 28, 2023 02:00 PM UTC

Hi Avinash,


We have included the fix for the issue "Text color is missing while using RGB value in HTML string" with our package version 20.4.54. So, can you please upgrade your package to the latest to resolve the issue from your end.


Regards,

Vinothkumar


Loader.
Live Chat Icon For mobile
Up arrow icon