procedure Tformmain.chinareport;//中国式报表
var
sqlstr:string;
i,j:integer;
begin
  sqlstr:='select * into #mytemp from password1'; 
  cn.Execute(sqlstr);//将需打印的内容装入临时表
  sqlstr:='select * from #mytemp';
  pubcs.Recordset:=cn.Execute(sqlstr);
  if (pubcs.RecordCount mod 27)<>0 then 
  //27是一页可以显示的记录数据,请先用普通报表打印后查看
     begin
       j:=27-(pubcs.RecordCount mod 27);//j为还需要补齐的记录数
       for i:=1 to j do  //插入不够一页的行记录
         begin
           sqlstr:='insert #mytemp (username,password,usertype,inputname) values  ('''','''',null,'''')';
           cn.Execute(sqlstr);
         end;
     end;
  try
     sqlstr:='select * from #mytemp order by ID';  //按ID号排序,将新增的空记录放在最后
     pubcs.Close;
     pubcs.SQL.Text:=sqlstr;
     pubcs.Open;
     frxdb1.DataSet:=pubcs;  //将补齐记录的数据装入报表数据源
     report1.ShowReport;
  finally
    cn.Execute('drop table #mytemp'); //打印成功与否都要将临时表删除
    frxdb1.DataSet:=nil;
  end;
end;
//以上是创建中国式报表的主要代码,如果您调式成功了,请UP一下;如果您还不能明白,请上我们的QQ群:18833620,我是人鱼传说,请向我要代码就行了!