在报表DETIAL上放两列你需要的QRLABEL,QUERY的DATASET设为空。
然后在报表的ONDEEDDATA事件中写:
procedure TQuickreport1.QuickRepNeedData(Sender: TObject;
var MoreData: Boolean);
var
i:Integer;
begin
with query1 do
begin
if not eof then MoreData := True;
for I:= 1 to 2 do
begin
case I of
1:begin
if not query1.eof then
begin
QRL_Name1.Caption :=FieldByName('name').AsString;
QRL_BodyId1.Caption :=FieldByName('bodyid').AsString;
QRL_Telephone1.Caption :=FieldByName('telephone').AsString;
QRL_CorpoName1.Caption :=FieldByName('corponame').AsString;
end
else
begin
QRL_Name1.Caption :='';
QRL_BodyId1.Caption :='';
QRL_Telephone1.Caption :='';
QRL_CorpoName1.Caption :=''
end;
end;
2:begin
if not query1.eof then
begin
QRL_Name2.Caption :=FieldByName('name').AsString;
QRL_BodyId2.Caption :=FieldByName('bodyid').AsString;
QRL_Telephone2.Caption :=FieldByName('telephone').AsString;
QRL_CorpoName2.Caption :=FieldByName('corponame').AsString;
end
else
begin
QRL_Name2.Caption :='';
QRL_BodyId2.Caption :='';
QRL_Telephone2.Caption :='';
QRL_CorpoName2.Caption :=''
end;
end;
end;
Next;
end;
end;
end;