打印本文 打印本文 关闭窗口 关闭窗口
Delphi程序执行时实时生成报表
作者:武汉SEO闵涛  文章来源:敏韬网  点击数3189  更新时间:2009/4/23 18:42:10  文章录入:mintao  责任编辑:mintao
;  end
      else begin
         Chg:=2;
         if ColWd.Text='''''''' then ColWd.Text:=''''200'''';
      end;
  if Chg<>Rd2 then begin PaperSizeChg(nil);Rd2:=Chg;end;
  ColWd.Enabled:=Chg<>0;
end;

procedure TPrintForm.QuickRepStartPage(Sender: TCustomQuickRep);
//报表打印开始新页事件处理,页脚带区中的统计值清空
Var
  I:Byte;
begin
if Tj1.Checked then
  For I:=0 to Query.FieldCount-1 do
    if Assigned(FBNAME[I]) then FBNAME[I].Reset;
end;

procedure TPrintForm.BtnPrintClick(Sender: TObject);
begin
  QuickRep.Print;
end;
end.
4、 调用对话框举例:
首先在将要调用的窗体中的USES语句中包含PrintDlg单元,然后可以用如下代码调用:
if not assigned(PrintForm) then PrintForm:=TPrintForm.Create(Application);
PrintForm.Query.SQL.Assign(Query.SQL);
//如果调用窗体不包含Query控件,可直接设置SQL语句的值
PrintForm.Bt:=报表标题;
PrintForm.Caption:=窗体标题;
PrintForm.CXTJ:=查询条件;
PrintForm.ShowModal;
5、 结束语
此程序关键是CreateReport事件过程和动态控件名称的处理。由于编幅所限,有些内容没有说明,希望读者自行体会。对于一般的报表生成,此程序能够满足要求。

本人有最新版本,功能更强,有需要的朋友可发邮件给我,一定邮的。

上一页  [1] [2] [3] [4] 

打印本文 打印本文 关闭窗口 关闭窗口