Board index » delphi » Database Memo field and storing RTF files in

Database Memo field and storing RTF files in

Help!!!!!!!!

I am very new to both Delphi and Database programming. I am trying to
write a program that will allow me to display formatted text (RTF
files) in a Rich Edit control based on a selection from a database. I
would like to store that RTF file in the database. I want to preserve
all the formatting.

I have set up a Paradaox 7 table with Database Desktop and declared a
field of type memo. I have and RTF file that I would like to place in
that field and preserve the format codes. I don't want to read the
file directly off disk because it will be copywrited material and
would like to put some type of security on it. Can this be done and
how.

I read in "Special Edition Using Delphi 2" that you could read an RTF
file into the Rich Edit control and the save it out as text then read
it into memory than place it in a database field of type string. Well
a database field of type string is only 255 characters. My files will
be more than that.  How do you read a text file into memory than
assign it to the database field.

Seth

 

Re:Database Memo field and storing RTF files in


Quote
Seth Parker (s...@dibbs.net) wrote:

: I read in "Special Edition Using Delphi 2" that you could read an RTF
: file into the Rich Edit control and the save it out as text then read
: it into memory than place it in a database field of type string. Well
: a database field of type string is only 255 characters. My files will
: be more than that.  How do you read a text file into memory than
: assign it to the database field.
Don't know if Delphi 2.0 offer something new but in 1.0 the only way to get
longer string data from/to a TMemoField is to use streams, especially the
TBlobStream. I guess the TRichEdit also has stream accessing methods like
LoadFromStream and SaveToStream, and you'll find similar ones at the
TMemoField.

Hope that helps,
   Andy

--
----------------------------------------------------------------------------
Andreas H"orstemeier                       | "Wenn ist das Nunstueck git
email: hoer...@hal1.physik.uni-dortmund.de | und Slotermeyer? Ja! Beiherhund
       a...@farpoint.sauerland.de          | das Oder die Flipperwaldt
fido:     2:2444/4505.3                    | gersput."
astronet: 122:490/1.53                     |                  (Monty Python)
----------------------------------------------------------------------------  

Re:Database Memo field and storing RTF files in


Quote
Seth Parker (s...@dibbs.net) wrote:

: Help!!!!!!!!
:
: I am very new to both Delphi and Database programming. I am trying to
: write a program that will allow me to display formatted text (RTF
: files) in a Rich Edit control based on a selection from a database. I
: would like to store that RTF file in the database. I want to preserve
: all the formatting.

Heres how I did, I dont have the codes here so its from memory, so keep
that in mind.  In mytable the field is called Notes and its a Memo field.

mytable.edit;
editform.richedit1.lines.assign(mytablenotes)
editform.showmodal;
mytablenotes.assign(editform.richedit1.lines);
mytable.post;

I hope that is close enough to help.

--robin

--
,--------------------------------------------------------------------------,
|http://www.winternet.com/~robin     | The Mystical Internet / WWW Equinox |
|ftp://ftp.winternet.com/users/robin | Magick WinHelp and Text archives    |
|snail: Robin                        | PO Box 2333 Minneapolis MN USA 55402|
'--------------------------------------------------------------------------'

Re:Database Memo field and storing RTF files in


Quote
>I read in "Special Edition Using Delphi 2" that you could read an RTF
>file into the Rich Edit control and the save it out as text then read
>it into memory than place it in a database field of type string. Well
>a database field of type string is only 255 characters. My files will
>be more than that.  How do you read a text file into memory than
>assign it to the database field.

        That sure is a DUMB way to do it. Use a TBLOBSTREAM, and then LOADFROMSTREAM
andSAVETOSTREAM methods of the LINES property.

_
******************************************************************
NOTE: This software is currently in early alpha. If you notice any
problems, or RFC non-compliance, please report it to p...@pobox.com
Please do not report duplicates, as this is usually a manual resend
+------------------------------------------------------------+
|Chad Z. Hower  -  phoe...@pobox.com                         |
|Phoenix Business Enterprises - p...@pobox.com - www.pbe.com  |
|Physically in Church Hill, TN - Logically Not Sure          |
+------------------------------------------------------------+

Quote
>>SQUID - The ultimate 32 bit offline databasing reader

**Special Compile: 3.000A (Alpha)

Other Threads