Class TfrmRepeatHeader (unit repeats) |
Inherits from
TForm
QuickReport 2.0 for Delphi 1.0/2.0/3.0
Example work around to repeat group headers
A simple example to show a work around that allows you to repeat group
bands on page breaks. The way around this is to use child bands on the
page hader band that duplicate the layout of the group header bands.
Please note that this report will not work correctly when previewed at
design time. This requires the BeforePrint events to do the work around
and you will not see it working until you actually run the report.
This report has two group header bands and each header is "mirrored" with
a matching child band connected to the Pageheader band.
procedure ChildBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
In the detail band, set the captions on the pageheader child bands.
procedure ChildBand2BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
We only print the child band after the first page and when the the next
detail band to be printed is in this group.
procedure DetailBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
ChildBand1 : TQRChildBand;
ChildBand2 : TQRChildBand;
DetailBand1 : TQRBand;
PageHeaderBand1 : TQRBand;
QRDBText1 : TQRDBText;
QRDBText2 : TQRDBText;
QRDBText3 : TQRDBText;
QRGroup1 : TQRGroup;
QRGroup2 : TQRGroup;
QRLabel1 : TQRLabel;
QRLabel2 : TQRLabel;
QRLabel3 : TQRLabel;
QRLabel4 : TQRLabel;
QRSysData1 : TQRSysData;
Query1 : TQuery;
Query1Addr1 : TStringField;
Query1Addr2 : TStringField;
Query1AmountPaid : TCurrencyField;
Query1City : TStringField;
Query1Company : TStringField;
Query1Contact : TStringField;
Query1Country : TStringField;
Query1custno : TFloatField;
Query1custno_1 : TFloatField;
Query1Discount : TFloatField;
Query1EmpNo : TIntegerField;
Query1FAX : TStringField;
Query1Freight : TCurrencyField;
Query1ItemNo : TFloatField;
Query1ItemsTotal : TCurrencyField;
Query1LastInvoiceDate : TDateTimeField;
Query1orderno : TFloatField;
Query1orderno_1 : TFloatField;
Query1PartNo : TFloatField;
Query1PaymentMethod : TStringField;
Query1Phone : TStringField;
Query1PO : TStringField;
Query1Qty : TIntegerField;
Query1SaleDate : TDateTimeField;
Query1ShipDate : TDateTimeField;
Query1ShipToAddr1 : TStringField;
Query1ShipToAddr2 : TStringField;
Query1ShipToCity : TStringField;
Query1ShipToContact : TStringField;
Query1ShipToCountry : TStringField;
Query1ShipToPhone : TStringField;
Query1ShipToState : TStringField;
Query1ShipToZip : TStringField;
Query1ShipVIA : TStringField;
Query1State : TStringField;
Query1TaxRate : TFloatField;
Query1TaxRate_1 : TFloatField;
Query1Terms : TStringField;
Query1Zip : TStringField;
QuickRep1 : TQuickRep;
RepeatCompany : TQRLabel;
RepeatOrderNo : TQRLabel;
procedure ChildBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
In the detail band, set the captions on the pageheader child bands. This
is how we will know when to print the child bands on a page break. If a new
group starts on the next page, we can compare the current record with the
saved groups. If they don't match, we skip the child band.
procedure ChildBand2BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
We only print the child band after the first page and when the the next
detail band to be printed is in this group.
procedure DetailBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
ChildBand1 : TQRChildBand;
ChildBand2 : TQRChildBand;
DetailBand1 : TQRBand;
PageHeaderBand1 : TQRBand;
QRDBText1 : TQRDBText;
QRDBText2 : TQRDBText;
QRDBText3 : TQRDBText;
QRGroup1 : TQRGroup;
QRGroup2 : TQRGroup;
QRLabel1 : TQRLabel;
QRLabel2 : TQRLabel;
QRLabel3 : TQRLabel;
QRLabel4 : TQRLabel;
QRSysData1 : TQRSysData;
Query1 : TQuery;
Query1Addr1 : TStringField;
Query1Addr2 : TStringField;
Query1AmountPaid : TCurrencyField;
Query1City : TStringField;
Query1Company : TStringField;
Query1Contact : TStringField;
Query1Country : TStringField;
Query1custno : TFloatField;
Query1custno_1 : TFloatField;
Query1Discount : TFloatField;
Query1EmpNo : TIntegerField;
Query1FAX : TStringField;
Query1Freight : TCurrencyField;
Query1ItemNo : TFloatField;
Query1ItemsTotal : TCurrencyField;
Query1LastInvoiceDate : TDateTimeField;
Query1orderno : TFloatField;
Query1orderno_1 : TFloatField;
Query1PartNo : TFloatField;
Query1PaymentMethod : TStringField;
Query1Phone : TStringField;
Query1PO : TStringField;
Query1Qty : TIntegerField;
Query1SaleDate : TDateTimeField;
Query1ShipDate : TDateTimeField;
Query1ShipToAddr1 : TStringField;
Query1ShipToAddr2 : TStringField;
Query1ShipToCity : TStringField;
Query1ShipToContact : TStringField;
Query1ShipToCountry : TStringField;
Query1ShipToPhone : TStringField;
Query1ShipToState : TStringField;
Query1ShipToZip : TStringField;
Query1ShipVIA : TStringField;
Query1State : TStringField;
Query1TaxRate : TFloatField;
Query1TaxRate_1 : TFloatField;
Query1Terms : TStringField;
Query1Zip : TStringField;
QuickRep1 : TQuickRep;
RepeatCompany : TQRLabel;
RepeatOrderNo : TQRLabel;