這個問題應該不難,我也在做這個的報表
你先把要顯示的數據查詢出來插入到一個臨時表中
判斷記錄條數,你先設定一個常數為你要顯示的行數
再用MOD方法,當記錄為夠時,插入記錄到臨時表中如裡是字符串就用‘0’表示
如:
Procedure TPrintFrm.GetQuoteInfo;
var
num, i, iCount: Integer;
begin
with qrytempdo
begin
close;
sql.Clear;
sql.Text := ' select * into #tempOA from O_PurOrderApplyDet where sysOANo = '+quotedstr(frm_PurOrderApply.qryhead.fieldByName('OANo').AsString);
ExecSQL;
end;
with qrytempdo
begin
close;
sql.Clear;
sql.Text := 'select * from #tempOA';
Open;
end;
iCount := qrytemp.RecordCount + 1 ;
num := ICount mod rowcount ;
if num <> 1 then
begin
with qryTempdo
begin
Append;
FieldByName('sysOANo').Value := frm_PurOrderApply.qryhead.fieldByName('OANo').AsString;
FieldByName('SerialNo').Value := 0;
FieldByName('ItemNo').Value := '***¥H¤UªÅ¥Õ***';
FieldByName('Price').Value := 0;
FieldByName('Qty').value := 0;
Post;
end;
for i := 1 to (rowcount - iCount)do
begin
with qryTempdo
begin
Inc(iCount);
Append;
FieldByName('sysOANo').Value := frm_PurOrderApply.qryhead.fieldByName('OANo').AsString;
FieldByName('SerialNo').Value := 0;
FieldByName('Price').Value := 0;
FieldByName('Qty').value := 0;
Post;
end;
end;
end;
end;