RE: Reports in delphi?
"Nesler, Thomas J" <[email protected]> Mon, 23 Jun 2003 09:07:34 -0500
| Newsgroups | gmane.comp.lang.delphi.quick-reports |
|---|---|
| Message-ID | <A787F31512A25E4F9782045CFE320C801526B5@NHQ1ACCOEX05VS1.corporate.amfam.com> |
Hello! -----Original Message----- From: aboanas_elists [mailto:[email protected]] I try to print a report using quick report. every thing is OK accept that I want to print two columns of datat in one page I try to do it but I can't??? I want it like this item1 item2 item3 item4 . . . etc IS THERE ANY WAY TO DO IT ???? >>>>> Absolutely, but you will need to do a little coding to make it work. Here is the trick: 1. Create your report. Leave the number of columns at the default 1 column. 2. Activate your detail band. In the Detail band place a QRLabel for each field you need. You will need to set up two different groups of labels. One set for the left column and one set for the right column. 3. In the Detail Band's BeforePrint event, load each label with the data you want printed for the left column and then advance the table to the next record and load the data for the right column. Here is an example: procedure TForm1.DetailBand1BeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean); begin QRLabel2.Caption := ''; { empty labels in col 2 if only col 1 is populated - on the last line } QRLabel1.Caption := Table1.FieldByName('Item').asString; {If you need more labels filled, enter them next} if Table1.EOF then Exit {Stop printing} else Table1.Next; QRLabel2.Caption := Table1.FieldByName('Item').asString; {If you need more labels filled, enter them next} end; What you are doing is interrupting the normal table advancement handled by QR so you can go through two records each time you print one row. You can print any number of columns and several lines on each label by using this technique. Hope this explains it, Tom Nesler Live long... Code well... and Prosper!... V ------------------------ Yahoo! Groups Sponsor ---------------------~--> Looking for the latest Free IT White Papers? Visit SearchNetworking.com to access over 500 white papers. Get instant access at SearchNetworking.com Today http://us.click.yahoo.com/8lAzoD/OLNGAA/witMAA/i7folB/TM ---------------------------------------------------------------------~-> ============================================= QReport Artist 5 - http://www.mensand.com/ The new version is available for Delphi 5.0 , Delphi 4.0 and Delphi 3, BC++Builder 3.0. and BC++Builder 4.0 ============================================= Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/