1. Tech

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

RTL reference|Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link To
Quick Reports Tutorial
Page 8: Overview of Quick Report components; Printing problems
 More of this Feature
• Page 1: Reports Overview
• Page 2: What's in a report
• Page 3: History of QR
• Page 4: Band reports
• Page 5: Calculated fields
• Page 6: Sorting & Grouping
• Page 7: Label Reports
• Page 9: Without the QR
 Join the Discussion
"Post your questions, concerns, views and comments to this article..."
 Related Resources
• Reporting Tools
• Printing with TPrinter
• Controling MS Office

   Overview of Quick Report components

This component is used for entering text which usually does not change during the course of the report. You can change the text programmatically but most of the time the text is static and is used to explain what the data means. To change the Text programmatically, use the On Print event. To prevent the label from printing, change the enabled property to False.

This component does most of the work in QR. You connect it to a field in your database table and then let it go. Normally you would leave the Autosize property as True and the Autostretch as False. This means that the field can stretch horizontally to fit the data but does not wrap text. If the field is a memo, then set Autostretch to True so the wrapping function works. You should also turn off the Autosize property and manually size the field so that the data wraps at the right point on your report. Memo fields are very challenging in report writing especially when hitting page breaks. Other problems with memo fields are when showing multiple memos on the same detail line.

This component was covered earlier, so no more comments are needed here.

This component handles data from the computer itself and the Qreport component such as page number and date. If you want to center one of these components (such as the Report Title) set the Align to band as True and the Alignment to taCenter. There is also a Text property which you can use to explain the data such as 'Page No:' or 'Print Date'. This makes it easier than adding a separate label along with the Sysdata component. The Data used for the Report Title comes from the QuickRep component's Report Title Property. This is a good habit to get into because some networks require a report name for tracking purposes and will use this data to do this.

This component is deceptive in that it is not used for printing memo field data. Instead it is to allow one component to hold many lines of text on a report form. The way it does this is to use the Lines property to allow you to format your text the way you want it. Turn off the Autosize and Autostretch properties and manually stretch the component until the lines look the way you want.

QRRichText Memo
This component is similar to the QRMemo except that it allows the text to be formatted. The Autosize property is not available at design time. You can use this component to prepare a preformatted form in which at run time you replace text inside the memo with text from a database like the insert function of MS Word. To do this you need to add the RichText component to the report and use it to enter your text. Then use the ParentRichEdit property to link the RichText component to the QRRichTextMemo. The Richtext component has the ability to search and replace.

QRDBRichText Memo
This is the component used to handle memo fields in databases. It has entries to put in the Table name and field name. Be sure to turn on the Autostretch property so that all data is printed. When setting up your layout, be sure to allow enough space so that your components stretch properly. Each component is handled once from left to right with QR trying to maintain the original spacing. If you do not leave enough space and Autosize and Autostretch are true you can get some strange results.

This component is used to handle lines and other shapes. It is the paper version of the Shape component located on the Additional components tab. Therefore most of the properties are the same. The component can be placed in a band and therefore print every time the band is printed. Or you can use it to position the graphic on a certain part of the paper and it will always print there. To do this, place the graphic below all the bands on your report and then move it to the place on the paper you want it to go. You will need to change the Pen Mode of the graphic to pmMask to see what is supposed to be inside the graphic. Unfortunately you will need to put all your printing components on the bands of the report you want before you place the shape component over them. Anything you place inside the shape becomes part of the shape and only prints once per page. Another method of handling graphics is to use the Frame property, which is found in all printable components (even the QRShape component). The Frame property allows you to create boxes around data and make them look better. You can alter the style of a frame just like you can alter the style of a shape.

This component lets you place a bitmap or other graphic on a report such as a logo. It is a descendent of the Image component and therefore has an Image editor which allows you to load a bitmap or other graphic into the space you have created for it. Use the Autosize, Stretch and Center properties to display the graphic where you want. Like the QRShape, placing QRImage in a band or outside of the bands, you can put it where you want.

This is the Dataware version of QRImage and is used to display graphics from files. It has similar properties and similar behaviors as the QRImage component.

QRComposite Report
QRComposite report does not work in an intuitive fashion. It does much more than simply calling one report after the other. Because a metafile is created for each page and this file is used to send data to the printer, Qrcomposite report uses this feature to make all the reports behave like one big report with each page being created and sent in one operation. To use this component, follow these steps:

1. Design all the reports you are using, each one in it's separate file and form. Add the units to the calling form so it can use them.

2. Place a QRCompositeReport component on your main form.

3. Click on the Add reports event and place code there to call each report in the order you want. Like this:

procedure Tform1.
 (Sender : Tobject);
 with QRCompositeReport1.Reports do

4. In your main form's code add the line to print or preview this component. Like This:


When you call this, the composite component calls each report in turn and adds the second through last report's pages to the first report's pages creating one large report. This is an attempt to seamlessly stitch together different reports to give the user the idea that all this output came from one report. It can be very useful if you have one report showing detail records and then need to print a report showing summaries for example. Another approach would be to simply call each report in turn individually, but this may not give the impression to the user that you may want. Having the Composite report component gives you a choice.

This component allows you to print a Tchart inside a report. You will need to create the chart inside the component by clicking on the Tchart Dialog in the chart property. See the TChart documentation on all the features that are available there.

You have the choice to print your chart as a Bitmap or as a metafile. I have no experience with either, so I recommend the default metafile, but you may want to experiment with the bitmap option if you need to.

   Previewing Reports
The QR QuickRep component comes with it's own preview component so you don't have to do anything to use it. Simply call the method from your code Like this:


See the report basics section for the full set of code to create a quick report and preview it. Inside the preview, you can set the paper and the printer manually and, when you are done, print the report. I prefer using this method because it gives users a chance to cancel a wrong report without wasting paper. If you have problems with this preview, you can create your own previewer. Go out to the QuSoft website to find a tutorial on creating your own.

   Printing problems
QR has had a bad rap because of the bugs that have been found and the slowness in fixing them. In all fairness, developers who did not pay the $99 to QuSoft for the source code were at the mercy of QuSoft when it came to fixing problems. Those who did pay the fee for QR pro were able to get fixes quicker and could do their own troubleshooting. Nevertheless it is highly recommended that you keep an eye on the QuSoft page for the latest release of the version of QR you are on. Most known bugs will eventually be fixed and will save you a lot of grief. As was stated in the beginning of this tutorial, many reporting problems are related to the windows print drivers and how they work with QR.

Next page > Printing without using Quick Report components > Page 1, 2, 3, 4, 5, 6, 7, 8, 9

All graphics (if any) in this feature created by Zarko Gajic.

 More Delphi
· Learn another routine every day - RTL Quick Reference.
· Download free source code applications and components.
· Talk about Delphi Programming, real time.
· Link to the Delphi Programming site from your Web pages.
· Tutorials, articles, tech. tips by date: 2001|2000|1999|1998 or by TOPIC.
· NEXT ARTICLE: Your application will be shut down!.
Access violations, invalid page faults, general protection faults; the name changes, but the nature of the problem is always the same. Find the solution to your Delphi AVs.
 Stay informed with all new and interesting things about Delphi (for free).
Subscribe to the Newsletter

 Got some code to share? Got a question? Need some help?

©2016 About.com. All rights reserved.