Description


Adding the contents of a UTF-16 encoded text stream to the document.



function AppendTextFromStream (Stream: TStream; StyleNo, ParaNo: Integer; AsSingleParagraph: Boolean): Boolean;

 Parameter

 Description

 Stream

 The stream that contains the UTF-16 encoded text file.

 StyleNo

 The number of the text style. Not used, use the value 0.

 ParaNo

 Optional parameter. If ParaNo=-1, the method adds an item to the end of the last paragraph. If ParaNo>=0, this item starts a new paragraph.

 AsSingleParagraph

 If False, each new line will be added as a new paragraph.  If True, it treats #13 and #10 as line breaks, not paragraph breaks.



Example



   procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
   var
       TxtFile: TFileStream;
   begin
       TxtFile := TFileStream.Create('d:\file.txt', fmOpenRead);
       try
           Form1.RichEdit1.AppendTextFromStream(TxtFile, 0, -1, True);
       finally
           TxtFile.Free;
       end;
   end;