Hi oxie.
I got this from the QuickReport FAQ
Q. How can I have my custom preview print a range of pages without going through the printersetup dialog?
A. What you need to do is to add a public property of your preview form of type TQuickRep like the following:
type
TfrmPreview = class(TForm)
QRPreview: TQRPreview;
.....
public
{ Public declarations }
CurrentReport : TQuickRep;
end;
In the OnPreview event of the report, you would use something like:
procedure TfrmMyReport.QuickRep1Preview(Sender: TObject);
begin
with frmPreview do
begin
CurrentReport := QuickRep1;
QRPreview.QRPrinter := TQRPrinter(Sender);
Show;
end
end;
That lets you reference the calling report through the preview's CurrentReport variable. Then to print out a range of pages with out going through the printer setup, you would do something like the following:
with CurrentReport.PrinterSettings do
begin
{ To set your own printer }
PrinterIndex := MyDesignatedPrinterIndex;
{ set the page range }
FirstPage := MyDesignatedFirstPage;
LastPage := MyDesignatedLastPage;
end;
QRPreview.qrprinter.Print;
With Quick Report 3, the Master property of the qrprinter is the report that owns it.
------------------