Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QRPreview 1

Status
Not open for further replies.

oxie

Programmer
Aug 23, 2002
7
FR
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.

Thanks.
 
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.
------------------


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top