Description


Exports document (or the selected part, if SelectionOnly=True) to the Stream as RTF (Rich Text Format).



function SaveRTFToStream (Stream: TStream; SelectionOnly: Boolean = False): Boolean

 Parameter

 Description

 Stream

 The stream into which the document is saved in RTF format.

 SelectionOnly

 Optional parameter. If True, only selected part of the document is saved.



Example


   procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
   var
       RTF: TFileStream;
   begin
       RTF := TFileStream.Create('d:\file.rtf', fmCreate);
       try
           if Form1.RichEdit1.SaveRTFToStream(RTF) then
               ShowMessage('File saved successfully')
           else
               ShowMessage('There was an error during the export.');
       finally
           RTF.Free;
       end;
   end;