Copy RTF in Delphi

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Copy RTF in Delphi

Postby kneff » Thu Dec 13, 2007 8:59 pm

Hi all; I'm trying to copy the contents of a Rich Text Edit into VPE keeping the existing formatting. I have tried to copy to a pchar buffer and a normal copy and just get the text in VPE with no formatting.
Any easy way to accomplish this? (I'm not a Delphi wizard!)
Thanks for any help.
Keith
kneff
 
Posts: 3
Joined: Thu Dec 13, 2007 8:52 pm

Postby IDEAL Software Support » Fri Dec 14, 2007 3:42 pm

I found the following code immediately by using Google:

Code: Select all
function GetRTF(RE: TRichedit): string;
var
   strStream: TStringStream;
begin
   strStream := TStringStream.Create('') ;
   try
     RE.PlainText := False;
     RE.Lines.SaveToStream(strStream) ;
     Result := strStream.DataString;
   finally
     strStream.Free
   end;
end;


You can then create a Rich Text object in VPE for example with:

Code: Select all
str := GetRTF(MyRichEdit);
Vpe.WriteRTF(1, 1, 19, VFREE, str);


Regards
Thorsten Radde
IDEAL Software GmbH
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Thanks much

Postby kneff » Fri Dec 14, 2007 4:30 pm

I'll give it a try.
kneff
 
Posts: 3
Joined: Thu Dec 13, 2007 8:52 pm

Works like a champ!

Postby kneff » Fri Dec 14, 2007 5:24 pm

OK now I'm buying VPE, thanks
kneff
 
Posts: 3
Joined: Thu Dec 13, 2007 8:52 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 13 guests

cron