Description


Exports document (or the selected part, if SelectionOnly=True) to the stream Stream as DocX (Microsoft Word format).



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

 Parameter

 Description

 Stream

 The stream into which the document is saved in DocX 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
       DocX: TFileStream;
   begin
       DocX := TFileStream.Create('d:\file.docx', fmCreate);
       try
           if Form1.RichEdit1.SaveDocXToStream(DocX) then
               ShowMessage('File saved successfully')
           else
               ShowMessage('There was an error during the export.');
       finally
           DocX.Free;
       end;
   end;