Page 1 of 1
How to get RTF text into variable?
Posted: Thu Feb 18, 2010 8:09 am
by Bolo
How to get RTF text from RichViewEdit?
I need get formated text into String (WideString?) and put into another component. Unfortunatly - I can't use Stream
(only variable).
Posted: Thu Feb 18, 2010 9:59 am
by Sergey Tkachenko
Code: Select all
// TRVAnsiString is defined as String for Delphi 3-2007, and as AnsiString for Delphi 2009+
function GetRTFString(rv: TCustomRichView): TRVAnsiString;
var Stream: TMemoryStream;
begin
Stream := TMemoryStream.Create;
try
rv.SaveRTFToStream(Stream, False);
SetLength(Result, Stream.Size);
Stream.Position := 0;
Stream.ReadBuffer(PRVAnsiChar(Result)^, Length(Result));
finally
Stream.Free;
end;
end;
Posted: Thu Feb 18, 2010 1:56 pm
by Bolo
Ok, and what is "PRVAnsiChar" - Delphi7 dosent known it!
Posted: Thu Feb 18, 2010 2:21 pm
by Sergey Tkachenko
PRVAnsiChar and TRVAnsiString are defined in RVTypes.pas
Posted: Mon Feb 22, 2010 6:55 am
by Bolo
Thanx