这个问题我已经实现了.使用临时表
我的代码:
你要把查询数据先写到临时表中,再执行此过程
procedure InitBill(const RowNum:integer);//RowNum固定的行数
var
N1,i,NumRecord:integer;
str_sql:string;
begin
str_sql:='select * from 表名';//用你的查询语句代替(我使用临时表)
Run_Open_sql(str_sql); //我的过程,我要偷懒了,你知道它什么意思
NumRecord:=Query.recordcount;//查询数据的总行数
if NumRecord<>0 then
begin
N1:=NumRecord Mod RowNum;
if N1<>0 then
begin
for i:=1 to RowNum-N1 do //插入空行
begin
NumRecord:=NumRecord+1;
Query.Insert; //我使用临时表,索引字段'RecordNo',打印时不打印
Query.FieldByName('RecordNo').asInteger:=NumRecord;
Query.Post;
end;
end;
end;
end;