Board index » cppbuilder » Stroring RTFtext into AnsiString
Sam
![]() CBuilder Developer |
Sam
![]() CBuilder Developer |
Stroring RTFtext into AnsiString2004-06-04 06:09:22 PM cppbuilder113 I need to strore RTF text at run time into a variable like this: RichEdit1->PasteFromClipboard(); AnsiString sBuffer=RichEdit1->Lines->Text; But the result is that, sBuffer contains ANSI text not RTF text. Why could I do ? Sam |
JD
![]() CBuilder Developer |
2004-06-04 06:51:45 PM
Re:Stroring RTFtext into AnsiString
"Sam" < XXXX@XXXXX.COM >wrote:
Quote[...] But the result is that, sBuffer contains ANSI text not www.geocities.com/rodolfofrino/ExtendedRichEdit.html If you're going to be using TRichEdit's to any extent, this site is good place to look over: home.att.net/~robertdunn/Yacs.html ~ JD |
Hans Galema
![]() CBuilder Developer |
2004-06-04 07:16:20 PM
Re:Stroring RTFtext into AnsiString
JD wrote:
QuoteRTF-encoded text can be retrieved from a Rich Edit control Hans. {smallsort} |
JD
![]() CBuilder Developer |
2004-06-04 07:19:59 PM
Re:Stroring RTFtext into AnsiString
Hans Galema < XXXX@XXXXX.COM >wrote:
QuoteJD wrote: QuoteI have no idea what kind of light it should shed. ~ JD |
Hans Galema
![]() CBuilder Developer |
2004-06-04 07:23:52 PM
Re:Stroring RTFtext into AnsiString
Sam wrote:
QuoteI need to strore RTF text at run time into a variable like this: A simple solution would be to let the TRichEdit save its contents in a .rtf file. Then load the file in a TStringList and assign its Text to the AnsiString. RichEdit1->PasteFromClipboard(); AnsiString FileName = "content.rtf"; RichEdit1->Lines->SaveToFile ( FileName ); // create a TStingList StringList->LoadFromFile ( FileName ); AnsiString asBuffer = StringList->Text; // delete the StringList ShowMessage ( asBuffer ); A nicer solution would be to stream the contents of the TRichEdit out. Hans. |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2004-06-05 02:28:02 AM
Re:Stroring RTFtext into AnsiString
"Sam" < XXXX@XXXXX.COM >wrote in message
QuoteBut the result is that, sBuffer contains ANSI text not RTF text. use its SaveToStream() method, such as to a TStringStream. You can then extract an AnsiString from that. Gambit |