display rtf saved in the database with proper format in react app

aynuayex 0 Reputation points

I have c# desktop application using the Microsoft's built in Microsoft Rich Textbox Control and we have used it to save the rtf in mssql database.

now i do want to display the rtf fetched from the database to be displayed in my react application with the proper format instead of with their encoding like below: ```

{\rtf1\fbidis\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Verdana;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fnil\fcharset0 Trebuchet MS;}} \viewkind4\uc1\pard\ltrpar\f0\fs20 Sharp costophrenic angles bilaterally . \par \par \pard\ltrpar\sl360\slmult1 There is no cardiac enlargement. \par There is no active lung parenchymal lesion. \par \f1\fs28 \par \pard\ltrpar\f0\fs20 Impression:Normal chest xray\f2\fs20 \par }

i have tried many libraries in react related to rtf but does not seem to work. how do i achieve that in my react application, any suggestions, guides would be appreciated, thanks in advance.
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,545 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 54,621 Reputation points

    You will need to find a RTF to html converter. Convert the RTF to html then display. There are commercial packages (usually for word support). RTF support has wained over the years and most of the libraries will be old. You might want to try (I've never used):


    If you envision editing the content with react, then you might want to migrate to a more common format like html or markdown (like the editor on this page).

    note: Most of the javascript based editors use html, because the browser has builtin support for editing html.

    0 comments No comments