/*
PrintToFile, SaveToFile, SaveDialog 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:
*/ 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  PrintDialog1->Options << poPrintToFile;
  PrintDialog1->PrintToFile = true;
  if (PrintDialog1->Execute())
  {
    if (PrintDialog1->PrintToFile)
    {
      SaveDialog1->Title = "Print to File:";
      if (SaveDialog1->Execute())
        RichEdit1->Lines->SaveToFile(SaveDialog1->FileName);
      else
        RichEdit1->Print("");
    }
  }
} 
