我现在要做一个报表,数据来源不是数据库,报表里要生成类似的许多组记录,自动生成TQRLABEL。
我在调用报表前初始化:
PrintSetup();
FrmPrint.QuickRep1.Prepare;
FrmPrint.QuickRep1.Preview;procedure TfrmClient.PrintSetup();
var
i:integer;
TopInt:integer;
total,TotalAmount:Real;
UnitePrice:string;
begin
FrmPrint := TFrmPrint.Create(Application);
//报表的head填入 FrmPrint.QRLUser.Caption:=edtUser.Text;
FrmPrint.QRLWorkDate.Caption:=edtDate.text;
FrmPrint.QRLPaymentID.Caption:=edtPaymentID.text;
FrmPrint.QRLRes.Caption:=edtRes.Text;
TotalAmount:=0;
for i:=1 to grdline.RowCount-1 do
begin
//参数格式如下:left,top,width,height,显示内容
TopInt := 7+38*(i-1);
Create_QRShape(10,TopInt,1010,1);
//LineNO
create_QRlabel(16,TopInt+12,73,17,grdline.Cells[0,i]);
//Product Name
create_QRlabel(96,TopInt+4,199,17,grdline.Cells[1,i]);
//OEM Product Name
create_QRlabel(128,TopInt+20,116,17,grdline.Cells[10,i]); //Res
create_QRlabel(731,TopInt+20,270,17,grdline.Cells[11,i]); end;
end;procedure TfrmClient.Create_QRlabel(LeftInt,TopInt,WidthInt,HeightInt:integer;InputStr:string);
var
QRLabel:TQRLabel;
begin
QRLabel:=TQRLabel.create(FrmPrint);
with QRLabel do
begin
parent:=FrmPrint.DetailBand1;
Left := LeftInt ;
Top := TopInt;
Width := WidthInt;
Height := HeightInt;
caption:=InputStr;
Frame.Color := clBlack;
Frame.DrawTop := False ;
Frame.DrawBottom := False;
Frame.DrawLeft := False ;
Frame.DrawRight := False;
Alignment := taLeftJustify;
AlignToBand := False;
AutoSize := False;
AutoStretch := False;
Color := clWhite;
Transparent := False;
WordWrap := True;
visible:=true;
end;
end;procedure TfrmClient.Create_QRShape(LeftInt,TopInt,WidthInt,HeightInt:integer);
var
QRShape:TQRShape;
begin
QRShape:=TQRShape.create(FrmPrint);
with QRShape do
begin
parent:=FrmPrint.DetailBand1;
Left := LeftInt ;
Top := TopInt;
Width := WidthInt;
Height := HeightInt;
Frame.Color := clBlack;
Frame.DrawTop := False;
Frame.DrawBottom := False;
Frame.DrawLeft := False;
Frame.DrawRight := False;
Shape := qrsRectangle;
end;
end;报表里包括pageheader,detail,还有pagefoot。
现在感觉是先在detail里自动生成了很多行Create_QRlabel,导致不能自动分页。
请教,如何能实现上诉功能的自动分页?
我在调用报表前初始化:
PrintSetup();
FrmPrint.QuickRep1.Prepare;
FrmPrint.QuickRep1.Preview;procedure TfrmClient.PrintSetup();
var
i:integer;
TopInt:integer;
total,TotalAmount:Real;
UnitePrice:string;
begin
FrmPrint := TFrmPrint.Create(Application);
//报表的head填入 FrmPrint.QRLUser.Caption:=edtUser.Text;
FrmPrint.QRLWorkDate.Caption:=edtDate.text;
FrmPrint.QRLPaymentID.Caption:=edtPaymentID.text;
FrmPrint.QRLRes.Caption:=edtRes.Text;
TotalAmount:=0;
for i:=1 to grdline.RowCount-1 do
begin
//参数格式如下:left,top,width,height,显示内容
TopInt := 7+38*(i-1);
Create_QRShape(10,TopInt,1010,1);
//LineNO
create_QRlabel(16,TopInt+12,73,17,grdline.Cells[0,i]);
//Product Name
create_QRlabel(96,TopInt+4,199,17,grdline.Cells[1,i]);
//OEM Product Name
create_QRlabel(128,TopInt+20,116,17,grdline.Cells[10,i]); //Res
create_QRlabel(731,TopInt+20,270,17,grdline.Cells[11,i]); end;
end;procedure TfrmClient.Create_QRlabel(LeftInt,TopInt,WidthInt,HeightInt:integer;InputStr:string);
var
QRLabel:TQRLabel;
begin
QRLabel:=TQRLabel.create(FrmPrint);
with QRLabel do
begin
parent:=FrmPrint.DetailBand1;
Left := LeftInt ;
Top := TopInt;
Width := WidthInt;
Height := HeightInt;
caption:=InputStr;
Frame.Color := clBlack;
Frame.DrawTop := False ;
Frame.DrawBottom := False;
Frame.DrawLeft := False ;
Frame.DrawRight := False;
Alignment := taLeftJustify;
AlignToBand := False;
AutoSize := False;
AutoStretch := False;
Color := clWhite;
Transparent := False;
WordWrap := True;
visible:=true;
end;
end;procedure TfrmClient.Create_QRShape(LeftInt,TopInt,WidthInt,HeightInt:integer);
var
QRShape:TQRShape;
begin
QRShape:=TQRShape.create(FrmPrint);
with QRShape do
begin
parent:=FrmPrint.DetailBand1;
Left := LeftInt ;
Top := TopInt;
Width := WidthInt;
Height := HeightInt;
Frame.Color := clBlack;
Frame.DrawTop := False;
Frame.DrawBottom := False;
Frame.DrawLeft := False;
Frame.DrawRight := False;
Shape := qrsRectangle;
end;
end;报表里包括pageheader,detail,还有pagefoot。
现在感觉是先在detail里自动生成了很多行Create_QRlabel,导致不能自动分页。
请教,如何能实现上诉功能的自动分页?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货