Skip to content

Instantly share code, notes, and snippets.

@frogonwheels
Created May 19, 2010 02:39
Show Gist options
  • Save frogonwheels/405887 to your computer and use it in GitHub Desktop.
Save frogonwheels/405887 to your computer and use it in GitHub Desktop.
Function GetRTFtext(Const RichEdit: TRichEdit): String;
var
MemoryStream : TMemoryStream;
RTFText : AnsiString;
begin
MemoryStream := TMemoryStream.Create;
try
RichEdit.Lines.SaveToStream(MemoryStream);
MemoryStream.position := 0;
if MemoryStream.size > 0 then
SetString(RTFText, pchar(MemoryStream.Memory), MemoryStream.size);
finally
FreeAndNil(MemoryStream);
end;
Result := String(RTFText);
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment