procedure tform1.setprint(dbgrid:tdbgrid,colhead,coLdetail:tband);
var
i,j :initeger;
lab:array of tQdblable;
tex:array of tQdbtext;
begin
j:=0;
setlength(lab,dbgrid1.columns.count-1);
setlength(tex,dbgrid1.columns.count-1);
for i:=0 to dbgrid1.columns.count-1 do
begin
lab:=tqdblable.create(self);
tex:=tqdbtext.create(self);
lab.auto:=true;
lab.parent:=colhead;//还有其他属性自已设置吧
lab.caption:=dbgrid.columns[i].titel;
tex.fieldname:=dbgrid.colunms[i].filename;
tex.parent:=coLdetail;
if i=0 then
beging
lab.left:=5;
tex.left:=5;
end
else
begin
lab.left:=j;
tex.left:=j;
end;
inc(j,dbgrid.columns[i].width)
end;
end;在quickrep.preview之前调这个过程则可
var
i,j :initeger;
lab:array of tQdblable;
tex:array of tQdbtext;
begin
j:=0;
setlength(lab,dbgrid1.columns.count-1);
setlength(tex,dbgrid1.columns.count-1);
for i:=0 to dbgrid1.columns.count-1 do
begin
lab:=tqdblable.create(self);
tex:=tqdbtext.create(self);
lab.auto:=true;
lab.parent:=colhead;//还有其他属性自已设置吧
lab.caption:=dbgrid.columns[i].titel;
tex.fieldname:=dbgrid.colunms[i].filename;
tex.parent:=coLdetail;
if i=0 then
beging
lab.left:=5;
tex.left:=5;
end
else
begin
lab.left:=j;
tex.left:=j;
end;
inc(j,dbgrid.columns[i].width)
end;
end;在quickrep.preview之前调这个过程则可
tex.fieldname:=dbgrid.colunms[i].filename;加
tex.datesoruce:=quickrep1.dateset;