Solved

Storing to a string variable from a Memo/Text field

Posted on 2001-08-01
4
253 Views
Last Modified: 2010-04-06
Hi Experts,

I have a memo/text field on an MSSQL 7 table.
I want to read this field and store whatever value here on a string variable declared on my application.
My problem is that after saving this value to my string variable, what is being stored is like this :

{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 MS Sans Serif;}{\f1\fnil MS Sans Serif;}}
{\colortbl ;\red0\green0\blue0;}
\viewkind4\uc1\pard\cf1\lang1033\f0\fs16 MYTEXT
\par \f1
\par }

Is there any function or something, that I can use to remove all the RTF formattings and simply get the text itself?
So based on the sample above, I only wanted to store the value "MYTEXT" on my string variable and exclude the RTF formattings.

If anybody can show me how to do this without using any components but simply delphi coding thru functions or procedures, I'll appreciate it wholeheartedly.

TIA,
jrmn


0
Comment
Question by:jrmn
  • 2
4 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6343437
just set the plaintext property to true of an TRichEdit-Component

well, you will not need a component, maybe you will find a parser
0
 
LVL 4

Author Comment

by:jrmn
ID: 6343482
Hi kretzschmar,

Yup, from the Database, I'll get the value from this field and store it on a local string variable...not putting it first on a TRichEdit or any other components.
I think a parser is one if not the best solution to this. Can you suggest a function/procedure to do this kind of stuff?

jrmn
0
 
LVL 3

Expert Comment

by:rondi
ID: 6343751
Hi jrmn (Jermaine ?),

Parsing may prove difficult, as RTF formatting can get
pretty complex. Play around with MS Word and type some
text containing chars like {, ? & \ and save as RTF.
Sometimes text is enclosed in braces {}, and some chars
are escaped with backslashes. So it would appear one
actually needs to interpret the various RTF markups.

I think the quickest workaround would be to put an
hidden RichEdit control somewhere (or create it) and
set PlainText := False; set the text to the string variable, then set PlainText := True; and retrieve the
text.

rondi.
0
 
LVL 3

Accepted Solution

by:
rondi earned 50 total points
ID: 6343755
Hi jrmn (Jermaine ?),

Parsing may prove difficult, as RTF formatting can get
pretty complex. Play around with MS Word and type some
text containing chars like {, ? & \ and save as RTF.
Sometimes text is enclosed in braces {}, and some chars
are escaped with backslashes. So it would appear one
actually needs to interpret the various RTF markups.

I think the quickest workaround would be to put an
hidden RichEdit control somewhere (or create it) and
set PlainText := False; set the text to the string variable, then set PlainText := True; and retrieve the
text.

rondi.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

773 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