Solved

Storing to a string variable from a Memo/Text field

Posted on 2001-08-01
4
247 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now