Hi,
Using the Print method of the QRPreview component, how can I specify the range of pages I want to print ?
In the PrintSetup dialog box, the "range" option is grayed.
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.
------------------
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.