`
dato0123
  • 浏览: 916892 次
文章分类
社区版块
存档分类
最新评论

用fastreport做中国式报表

 
阅读更多
  1. procedureTformmain.chinareport;//中国式报表
  2. var
  3. sqlstr:string;
  4. i,j:integer;
  5. begin
  6. sqlstr:='select*into#mytempfrompassword1';
  7. cn.Execute(sqlstr);//将需打印的内容装入临时表
  8. sqlstr:='select*from#mytemp';
  9. pubcs.Recordset:=cn.Execute(sqlstr);
  10. if(pubcs.RecordCountmod27)<>0then
  11. //27是一页可以显示的记录数据,请先用普通报表打印后查看
  12. begin
  13. j:=27-(pubcs.RecordCountmod27);//j为还需要补齐的记录数
  14. fori:=1tojdo//插入不够一页的行记录
  15. begin
  16. sqlstr:='insert#mytemp(username,password,usertype,inputname)values('''','''',null,'''')';
  17. cn.Execute(sqlstr);
  18. end;
  19. end;
  20. try
  21. sqlstr:='select*from#mytemporderbyID';//按ID号排序,将新增的空记录放在最后
  22. pubcs.Close;
  23. pubcs.SQL.Text:=sqlstr;
  24. pubcs.Open;
  25. frxdb1.DataSet:=pubcs;//将补齐记录的数据装入报表数据源
  26. report1.ShowReport;
  27. finally
  28. cn.Execute('droptable#mytemp');//打印成功与否都要将临时表删除
  29. frxdb1.DataSet:=nil;
  30. end;
  31. end;
//以上是创建中国式报表的主要代码,如果您调式成功了,请UP一下;如果您还不能明白,请上我们的:18833620,我是人鱼传说,请向我要代码就行了!
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics