1. Home
  2. Computing & Technology
  3. Delphi Programming

Get the RTF formatting from a RichEdit

By , About.com Guide

Here's how to get the pure RTF formatted text from a TRichEdit control.

Usage: Memo1.Text := GetRTF(RichEdit1) ;

~~~~~~~~~~~~~~~~~~~~~~~~~
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;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» How to place a progress bar inside a standard dialog box
« What's the word under the mouse cursor in a TRichEdit?

Explore Delphi Programming
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Using VCL Components
  5. TMemo, TRichEdit
  6. Get the RTF formatting from a RichEdit

©2010 About.com, a part of The New York Times Company.

All rights reserved.