?
Solved

Storing to a string variable from a Memo/Text field

Posted on 2001-08-01
4
Medium Priority
?
260 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
[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
  • 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 100 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month7 days, 21 hours left to enroll

765 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