; 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事件过程和动态控件名称的处理。由于编幅所限,有些内容没有说明,希望读者自行体会。对于一般的报表生成,此程序能够满足要求。