Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-02-24
5
Medium Priority
?
394 Views
Last Modified: 2012-05-11
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.
0
Comment
Question by:kwh3856
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 14

Expert Comment

by:quizwedge
ID: 34977255
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.
0
 
LVL 14

Accepted Solution

by:
robasta earned 2000 total points
ID: 34977292
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:

http://stackoverflow.com/questions/595865/get-plain-text-from-an-rtf-text
0
 

Author Comment

by:kwh3856
ID: 34977366
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???
0
 

Author Comment

by:kwh3856
ID: 34977398
or could it be that I am trying to access this from a webform in Visual Studio 10.
0
 

Author Closing Comment

by:kwh3856
ID: 34977487
Robasta,
Thank You!!!!!!!!

That was it.  I just had to add a reference to System.Windows.Forms.dll and everything worked fine.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question