• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 396
  • Last Modified:

RTF data in a SQL table that needs to be presented in a web application

I currently have an application that reads data from a table that exsits in a SQL 2008 server.  My application is a C# application using LINQ to read the data from the table.  Once I read the data from the table I then store it in a variable.  Next, I assign that variable to an Infragistics HTML editor.  I set the editor to read only mode.  I presumed the HTML editor was a rich text component and would convert the RTF text retrieved from the table in the database.  It does not.  When the editor is presented in the browser with the variable data, the editor shows

 {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}} \viewkind4\uc1\pard\f0\fs16 46 yr old MalePost OP F/UP per dr smith c/o neck pain radiate to bilat shoulders \fs17\par }

Does anyone know of viewer / editer / whatever will work      out there that will present just the body of text from the above line.  Again, this is a web application so I need some type of Microsoft / Third Party component that will work with my application.  Thanks in advance for any help you may give.
  • 3
1 Solution
I've never used it, so I don't know if it will work, but there is a free rich text editor at http://rte.codeplex.com/ that might be worth taking a look at.
a quick and dirty way is to  copy the text into a RichTextBox (namespace: system.windows.forms.richtextbox)

static public string ConvertToText(string rtf)
   RichTextBox rtb = new RichTextBox();
   rtb.Rtf = rtf;
   return rtb.Text;

Open in new window

see here:

kwh3856Author Commented:
that would work perfectly but system.windows.forms.richtextbox was not a namespace that could be found.  I am using .net 4.0 is that my problem???
kwh3856Author Commented:
or could it be that I am trying to access this from a webform in Visual Studio 10.
kwh3856Author Commented:
Thank You!!!!!!!!

That was it.  I just had to add a reference to System.Windows.Forms.dll and everything worked fine.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now