文档详情

Fastreport报表合并单元格技巧.doc

发布:2017-02-15约7.63千字共9页下载文档
文本预览下载声明
Fastreport报表合并单元格技巧 在做企业的ERP,SCM,CRM等等的软件中, 经常要做的就是报表, 如财务报表, 生产车间报表。很多时候企业可能对报表格式提出特别的要求,但作为软件开发公司,能设计开发出符合客户要求的报表就显得十分迫切。以下我对报表的合并技巧作一个总结,希望对后面要做类似报表的同事有些帮助。 合并报表1:江苏美的春花电器股价有限公司-委外加工材料月结表 在没有合并之前显示如下: 在对供应商编码和材料编码进行合并后显示如下: 对于合并功能,其实fastreport是有的,但这个功能做得远远不够,不能按客户的要求进行合并,要完成上述功能,我是通过下面的方法做出来的。 这种要求的合并要结合Delphi与Fastreport来协作完成。首先然前台Delphi相应方法中编写有关的算法,然后在Fastreport中根据这种算法作相应的显示。 操作方法如下: 选中Fastreport的主数据项,双击OnBeforePrint方法,在begin end 之间编写代码: MainData.Height:为每行数据显示的高度, [CLTAutoreporthead_AutoreportlineOfAutoreporthead.Flag]:表示要合并的行数(Delphi算法), 3.memo7.visible:是否显示单元格,[CLTAutoreporthead_AutoreportlineOfAutoreporthead.Search_Flag]=2:(Delphi算法), 只要在Delphi中把要合并的行数与列用字段Flag(控制行数),Search_Flag(控制是否可见,2为可见)算出来,再在FastReport中显示出来,那么合并功能就算搞好。 以下是在Delphi中的合并算法代码: function TAutoReportProcessMonthForm.GetFastRptObj: TBizObject; var BizHead,BizLine:TBizObject; i,j,k,n,m,p:Integer; Head:TAutoreporthead; Line:TAutoreportline; slItemVendor,slVendors:TStringList; strItemVendor,strItemVendor2,strVendor:String; VendorsCount:array of Integer; begin MyCheck; Head:=TAutoreporthead.Create(false,true); Head.UserName:=LoginUser.UserName; for i:=1 to dgView.RowCount-1 do if dgView.RowProps[i].Checked and (not dgView.IsRowEmpty(i))then begin Line:=TAutoreportline.Create; self.SetDgDataToBizObject(i,dgView,TBizObject(line)); head.AutoreportlineOfAutoreporthead.Add(line); end; //合并报表算法开始 added by wbc, 2009-04-23 slItemVendor:=TStringList.Create; slVendors:=TStringList.Create; for i:=0 to head.AutoreportlineOfAutoreporthead.Count-1 do begin strItemVendor:=TAutoreportline(head.AutoreportlineOfAutoreporthead.Items[i]).Item_Code+TAutoreportline(head.AutoreportlineOfAutoreporthead.Items[i]).Vendor_Code; if Pos(strItemVendor,slItemVendor.Text)=0 then slItemVendor.Add(strItemVendor); strVendor:=TAutoreportline(head.AutoreportlineOfAutoreporthead.Items[i]).Vendor_Code; if Pos(strVendor,slVendors.Text)=
显示全部
相似文档