Getting unformatted text from RichEdit

I have a Richedit that allows my users to format and view error messages that display within my application.

I now need to be able to export the text only (no formatting) out to another database that their trouble-ticket system uses.

I have tried all the combinations of PlainText I can think of and I always still get the rtf formatting.

How can I get the text only?

Answers


Answering the direct question that you asked, the Text property is precisely what you are looking for. For some reason it doesn't show up in the TRichEdit documentation, but it is inherited from TCustomEdit.

It sounds to me (following comments to Andreas' answer) as though what you really need to do it as follows:

  1. Pull the RTF from the DB into a memory stream or perhaps a blob stream.
  2. Call RichEdit.LoadFromStream passing that stream, making sure PlainText is False.
  3. Then read RichEdit.Text to get the unformatted text.

At the moment you are simply putting the RTF into the control as plain text. You need to put it into the control as rich text, and for that you need LoadFromStream.


To obtain the unformatted text, simply use RichEdit1.Text.


Need Your Help

Insert Picture into SQL Server 2005 Image Field using only SQL

sql sql-server sql-server-2005 image

Using SQL Server 2005 and Management Studio how do I insert a picture into an Image type column of a table?

Giving each subclass its own copy of a class variable

objective-c inheritance subclassing class-variables

I have the following class in my iOS application (it is like an abstract class from the Java world).

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.