{
PrintToFile, SaveToFile example
This example displays a print dialog box with a Print to File check box, and then prints the contents of a rich edit control to the indicated destination:
} 
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with PrintDialog1 do
  begin
  Options := [poPrintToFile];
  PrintToFile := True;
  if Execute then
    begin
    if PrintToFile then
      begin
      SaveDialog1.Title := 'Print to File: ';
      if SaveDialog1.Execute then
        RichEdit1.Lines.SaveToFile(SaveDialog1.FileName);
      end
    else
      RichEdit1.Print('');
    end;
  end;
end; 
