Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 796
  • Last Modified:

Preview Form using Quick Report 2.0

Can somebody explain to me and send me a full example of how to create and use a preview form other than the default one used by quick report 2.0
0
malaland
Asked:
malaland
  • 2
1 Solution
 
sxhCommented:
hi malaland

here is the extract from the Quickreport 0.97 manual for creating custom previews. It should'nt be that much different in delphi 2.0

Regards

sxh

Creating Custom Preview

A professional looking print preview is essential to the overall feel of your product.
One nice feature of QuickReport is the ability to create your own preview forms.  QuickReport is intended to integrate 100% with your application and to enable that you can very easily create your own report preview using the TQRPreview component.

There is also a very simple preview form included with the demonstration program. Take a look at DEMOPRE.PAS.

Basically creating a preview form consist of two steps
* Create a form with a TQRPreview component, plus any other components you would want.
* Show the your preview form in the QRPrinter.OnPreview event.

Following is a step by step guide to create a very simple preview form:

1. Open the Test project created above
2. Select File | New Form and double click on a blank form if you get the form gallery
3. Set the Name property of the form to MyPreviewForm
4. Drop a TQRPreview component on the form
5. Set the Align property to alClient
6. Select File | Save file and save the unit as MYPREV
7. Open the MAINFORM and view the source code
8. In the uses clause at the top add QUICKREP and MYPREV to the end of the list
9. Insert the following line in the MAINFORM.OnCreate event:
 
  QRPrinter.OnPreview := MyPreview;

10. Add The following procedure to the end of the code:
  procedure MyPreview;
  begin
     MyPrevForm.ShowModal;
  end;

13. Compile the project and preview the simple demo report.

You have now created a preview form that shows the first page of the report at 100% of the size. Maximise the form, and you see more of the report.

Now you can add an action bar to your preview form. Put components on it to change the PageNumber and Zoom properties of the aPreview component.
0
 
malalandAuthor Commented:
Sorry, but I guess you did not understood the question.

First I want to create a preview form with version 2.0 not 1.2, if that was the case I already know the answer to the question. There is a big difference between the two version. First there is no program called DEMOPRE.PAS in Delphi 3 that is why I asked for an example since there are none.

So thanks again bu the question still stands as it is. Same amount of points.

Hope to here from yourself or another experts.
0
 
xireCommented:
ok
do the following
1) create new form (let's call it rpreview)
2) put TQRPreview on this form
3) on your QuickRep form in QuickRep OnPreview event write this
   rpreview.QRPreview1.QRPrinter := QuickRep.QRPrinter; // this is the           //difference from qr1, i.e. you must assign QRPrinter
   rpreview.Show;

and that's it. Whenever you call YourReport.Preview rpreview form will appear.

hope it helps


0
 
malalandAuthor Commented:
You were right on the spot
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now