Fastreport v4 for Delphi: How to use the standard Windows select printer dialog?

Fastreport v4 with Delphi 2006

We need the printer dialog (the select printer dialog) to be the standard windows dialog.

How can we do this?

(We need it to look "right" and we do not want to document or support the features on the fastreport dialog)

Upvotes: 0

Views: 3933

Answers (1)

bummi
bummi

Reputation: 27377

Set frxReport.PrintOptions.ShowDialog to false and call your own dialog.

uses Printers;

Procedure PrintWithDialog(frxReport:TFrxReport ; PrintDialog:TCommonDialog ;const ReportName:String);
begin
  frxReport.LoadFromFile(ReportName);
  if PrintDialog.Execute then
  begin
    frxReport.PrintOptions.Printer := Printer.Printers[Printer.PrinterIndex];
    frxReport.PrintOptions.Copies := Printer.Copies;
    // other settings
    frxReport.PrintOptions.ShowDialog := false;
    frxReport.PrepareReport;
    frxReport.Print;
  end;
end;

Procedure TForm3.Button1Click(Sender: TObject);
begin
   PrintWithDialog(frxReport1,PrintDialog1,'C:\path\Report.Fr3');
   // OR
   PrintWithDialog(frxReport1,PrinterSetupDialog1,'C:\path\Report.Fr3');
end;

Upvotes: 2

Related Questions