procedure TForm12.CreateReport;
var
QRLalist:Array of TQRLabel;
QRTeList:Array of TQRDBText;
Count:Integer;
i,k:Integer;
begin
Count:=Pur_DM1.Pur_ADS2.FieldCount;
SetLength(QRLaList,Count);
SetLength(QRTeList,Count);
for i:=0 to high(QRTeList)do
begin
k:=0;
QRLaList:=TQRLabel.Create(self);
if i=0 then
QRLaList.Left:=38
else
QRLaList.Left:=QRLaList[i-1].Left+QRLaList[i-1].Width+12;
QRLaList.Parent:=QuickRep1;
QRLaList.AutoSize:=False;
Pur_DM1.Pur_ADS2.First;
while not Pur_DM1.Pur_ADS2.Eofdo
begin
if Pur_DM1.Pur_ADS2.Fields.DataSize>k then
k:=Pur_DM1.Pur_ADS2.Fields.DataSize;
Pur_DM1.Pur_ADS2.Next;
end;
QRLaList.Caption:=Pur_DM1.Pur_ADS2.Recordset.Fields.Name;
QRLaList.Top:=130;
if Pur_DM1.Pur_ADS2.FieldCount>12 then
begin
QRLaList.Font.Size:=7;
QRLaList.Width:=K*2+20;
end
else
begin
QRLaList.Font.Size:=8;
QRLaList.Width:=K*3+20;
end;
QRTeList:=TQRDBText.Create(self);
QRTeList.Parent:=DetailBand1;
QRTeList.DataSet:=Pur_DM1.Pur_ADS2;
QRTeList.DataField:=Pur_DM1.Pur_ADS2.Recordset.Fields.Name;
QRTeList.AutoSize:=True;
QRTeList.Font.Size:=QRLaList.Font.Size;
QRTeList.Top:=10;
QRTeList.Left:=QRLaList.Left-38;
end;
if Pur_DM1.Pur_ADS2.RecordCount/24<>Pur_DM1.Pur_ADS2.RecordCount div 24 then
QRExpr1.Expression:='''Page ''+'+'PAGENUMBER'+'+'' of ''+'+''''+FloatToStr(Pur_DM1.Pur_ADS2.RecordCount/24-(Pur_DM1.Pur_ADS2.RecordCount / 24-Pur_DM1.Pur_ADS2.RecordCount div 24)+1)+''''
else
QRExpr1.Expression:='''Page ''+'+'PAGENUMBER'+'+'' of ''+'+''''+IntToStr(Pur_DM1.Pur_ADS2.RecordCount div 24)+'''';
QuickRep1.Preview;
end;
可以给你参照一下。