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

   What makes up a report - Terms
There are two basic types of reports: Reports which have bands or sections on them and reports which repetitively print the same layout such as labels or forms. Makers of report writers usually can handle both types but sometimes one type is felt to be better than the other. Be flexible. Don't try to shoehorn a report into one format just because you feel more comfortable with it. On the other hand, realize that Band reports can handle forms for example, and label reports can simulate band styles.

Band style reports have this basic style:
First there is a Report Header. A report header only prints once and has information that you want to see on top of the report but not on each page. QR calls this band the Title band because it usually is where the Report title is located. This should be straightforward but unfortunately it has to interact with another Band call the Page header. The page header in QR prints first, then the Report header. Why? Because there is the possibility of printing something such as page numbers and print dates on each page and the Report title band would need to have duplicate data fields if it printed on the first page and then had the Page header print on the rest of the pages. Therefore, if you want to print a complete header page before you begin printing the report you will need to force a new page using the After print event of the Title band.

For example:

procedure TForm1.TitleBand1AfterPrint
 (Sender:TQRCustomBand; BandPrinted: Boolean); 
begin 
 QuickRep1.NewPage;
end;

   TIP #2
If you don't want the page header to print at all on the first page of the report because you are creating a title page, you will need to change the First page header setting to false in the options setting in the QuickRep component. There you can also turn off the last page header when printing the summary so that you can print a special summary page without the standard page info. Next in the order of printing is the Column Header Band. This band is useful for printing headings in simple reports. It is an optional band because you could place your column headings in the page header band instead if you wanted to. Another place to put headings is in the next band in the list called the Group Header. The Group header band is connected to the Grouping logic of your report and is another optional band. The main difference in the Column Header and the other options is; the Column header prints over the top of each column. If you have a multicolumn report this will be important.

Before we deal with Grouping, let's discuss the Detail band, which is the next band in the printing order. The Detail Band is the most important band in the report because it is where most of your data-aware components are placed. It can be stretched to cover a whole page and therefore become a type of Nonbanded report, or it can be removed if you are only printing a summary report without any details.

Next in the list is the Group Footer which handles any subtotals related to the grouping of the data. If you want each group to be printed on one page with the next group starting on the following page, then put a new page command in the Group Footer's After Print event.

For Example: QuickRep1.NewPage;

   TIP #3
If you want your totals in your group footer to start over after each group footer is printed, the change the Reset after Print Property to True instead of False. Leaving it as False will accumulate totals throughout the report.

The next band is the Summary Band which prints only at the end of the report. Like the Title, if you want the Summary Band to print on it's own page, you will need to insert a newpage command in the BeforePrint event so that the Summary begins on a separate page.

   TIP #4
If you want the Summary Band to always print at the Bottom of the report, then change the AlignToBottom property to True.

The final band printed is the page footer. This usually prints on each page at the bottom and, if you want it to, will print after the Summary Band. Page Headers and page footers are great places to put repeating information such as print date, page number, Company name, etc.

Next page > History of QR and what makes each version different > 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
Name
Email

 Got some code to share? Got a question? Need some help?
Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2009 About.com, a part of The New York Times Company.

All rights reserved.