...get the Rtf formating from a RichEdit?

Author: P. Below
Homepage: http://www.teamb.com

Category: VCL

function GetRTFText(ARichEdit: TRichedit): string;
var
  
ss: TStringStream;
  emptystr: string;
begin
  
emptystr := '';
  ss := TStringStream.Create(emptystr);
  try
    
ARichEdit.PlainText := False;
    ARichEdit.Lines.SaveToStream(ss);
    Result := ss.DataString;
  finally
    
ss.Free
  end;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
  
Memo1.Text := GetRTFText(RichEdit1);
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base