SaveTextToStreamA
Description
Exports document or selection as ANSI text.
function SaveTextToStreamA (const Path: String; Stream: TStream; LineWidth: Integer; SelectionOnly, TextOnly: Boolean): Boolean
Parameter |
Description |
Path |
Path for saving images and other non-text items. See TextOnly parameter. |
Stream |
The stream into which the document is saved in text format. |
LineWidth |
LineWidth is used for saving breaks (they are saved as LineWidth '-' characters) |
SelectionOnly |
If True, only selected part of the document is saved. |
TextOnly |
If True, non-text items are ignored when saving. If False, text representation of items is saved. |
Example
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
Txt: TFileStream;
begin
Txt := TFileStream.Create('d:\file.txt', fmCreate);
try
if Form1.RichEdit1.SaveTextToStreamA('', Txt, 1, False, True) then
ShowMessage('File saved successfully')
else
ShowMessage('There was an error during the export.');
finally
Txt.Free;
end;
end;