[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Storing to a string variable from a Memo/Text field

Posted on 2001-08-01
4
Medium Priority
?
264 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

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