通用简易报表打印程序(二).docx
!通用简易报表打印程序(二)!-不能打印通用型和备注型字段内容SelTalkOffClearwjm-Getlc("db)Use"&wjnr行数=0页数=Ia=Fcoun()1.ineS=25Pages=IiftMod(R<x>unl().1.ineS)<>OJnl(Rxounl(),1.incS+l).R<xcount(V1.ineS>DinnsionName(八),widc(八)StoreIToi.ccDoWhilei<>aStoreFicld(i>ToNamc(i).tIfTypcf&C)=wN'wide(i>=Max(1.en(T).Fsize(Name(i)wide(i)=Iif(wide(i)2=Int(wide(i)2).wide(i)wide(i)÷l)Elselfl>pc<,)=D'Widea)=8Elsewidc(i)=Max(t>(&t)wide(i)=Iif(M(xl(wkie(i),2)=0>wide(i).wide(i>÷l)EndifEndifi=i÷lEnddoEnd=i-1Hcad=Spacc(SO)18,30Say”请批入表名:',GetHeadReadi=lSizc=2DoWhilei<=EndSiZe=SiZe+wide+2i=i+lEnddoSciPrintOn?Sace(Size-1.en(Trim(Head)2+HeadDoWhile.Not.Eof()If1½>=1.incS*2+l?1.i=lDoWhilei<End?RcplicatcC-".wtdc(i)+-1-i=i+lEnddo?RePliCale("一".widdiM2)+“*?Spacc(10)+”第”+SH页数.2)+"页"+Spaccf1)+"共"+Str(Pagcs.2)+“页"IfSizoM)?SPaCe(SiZe60)+制表l期:"+Str(YeartDaem,4)+"年+;STR(Month(DaIeo)2H“月e+Str(Day(Date()2>+"HMEndif页数=页数+1行数=O°«1”EKet?Space(Size-1.en(TrinHHead)ZlH-HeadEndif?MilDoWhiIei<End?ReplicaieC-".widdi2)+,-ri=i÷lEnddo?RePIiCale1.wideOV2)、-1”?°Ii=lDoWhiIci<=End?NamedHSPaCe(Wide(i)1.eMNane(i)>>÷"I"i=i+lEnddo行数=行数+2DoWhiIetf½<1.ineS*2÷l.Al.Not.EofO?,Hi=1DoWhilei<End?RepIicateC-".wide(iy2)+"+i=i+lEnddo?RCPliCatC("一”,Widai*2)+“T-DOWhilei<=EndlfTypc(,namc(i),)=,'N'T=SlrtT.wide(i)ElseIfTypCCnamC(旷尸射T=Dtoc(AT)ElseT=Namdi)EndifEndif?&Tlfljpe(,)=N"?Spacc(widc(O-Esizc<Namc(i)>+HmElseIfTyPeC&l-)=D”?IwElse?Spcc(widc(i)-Ixn(T)÷''EndifEndifi=i+lEnddoSkipI行数=行数+2EnddoEnddoIf行数v>1.ineS*2+lQ1.i=lDoWhiIci<E11d?ReplicateC-".wide<iy2)+-1-i=i+lEnckio?Rcplica(-",widc(iy2)+"j"?SPaCe(10)+第”+Str(页数2W页”+Space(1>+"共"+Sir(Pagest2>+"页"IfSizc>60?SPaCdSiZC40)+”制表日期:“+Str(YCar(DatC().4)+“年+:STR(Month(Da侬),2)+"月"+SEDay(DatC(),21+“日”EndifQUHEndifSciPrintcrOffUseReturn !通用简易报表打印程序(三) !不能打印通用型和备注型字段内容 !*打印字段可自由选择SetTalkOffClearWjm=GeIfilWdbDUse',Awj11行数=0页数=Ia=Fcount()1.ineS=25Pagcs=lif(Mod(Rcccount().1.incS)oOJnt(Rcccount()1.incS+l).Reccount(y1.incS)1,6Say请选择栏名05B3030DimensionName(八).wi<lc(八)Store1Ibi,ccDoWhileccaj=DWhilej<=a-lj+1.11PromptFieIdG)j=j÷Enddo(Sa+2.llProtnpl”选择结束”Menu,occIfcc<>aStoreFieId(CC)TbName(i).IfDPCC&t*)=”N"Widaii=MaX(1.Cn.FsizdNamc(D)wkic(i)=IIF(widc(i)2=INT(widc(i)2).widc(iwidc(i)÷l)ElselfTypc(,()=D'wide(i)=8Elsewidc(i)=Max(t).1.EN(t)Wide(i>=Iif(Mod(wide2)=0.Widei),widel)EndifEndifElseIfi=IReturnElseExitEndifEndifi=i÷lEnddoEnd=i-1Hcad=Spacc(30)18,30Say”请位入友名:"GetHeadReadi=lSizc=2DoWhilei<=EndSize=size÷wide(i)+2i=i+lEnddoSetPrintOn?SPCE(Size-1.en<Tri11uHea<l)2)+HeadDoWhile.Not.Eof()If行数>=1.incs*2+l?”1.,i=lDoWhilei<En<l?RcplicatcC-".widc(iy2)+"-l-i=i+lEnddo?Replicate(".widdiy2)+"j*?Space(10)+"-+Str(!X½,2)+'!"+Space(1)+"共"+Str(Pascs.2+”页”lfSizc>60?SPaC以Size60)+制表H期:"+Str(Year(Da把0).4)+“年'+;STR(Month(DaleO).2>+"月+Slr(Day(Dale()>.2>+"B"Endif页数=页数+1行数=OQ«*«(Eject?Space(Size-1.en(TrinKHead)ZZH-HeadEndifi=lDoWhiIei<El?RepIicaleC-,*.widdW2)+”丁i=i+iEiukio?Replica(eC,-,*.wide(iy2)+'-”?"Ii=lDoWhiIci<=End?Na>(i)+Space(wi<le(i)1.en(Na11)e(i)H-"I,i=i+lEnddo行数=行数+2DoWhiIe行数<1.ines*2+l.And.Not.EOfO?"H'i=lDoWhilei<En<l?RepIicateC-,wi<le(i)+"+i=i+lEnddo?RcpIicatcC-".widc(iy2)+"H"?"Ii=lDoWhilei<=Endlfl>pc(',namc(i)w>=',N't=S(r(t.wide(i)ElseIfryPC("namc(i>="D"t=Dtoc(&t)Elset=Name(i)EndifEndif?&(lf1jpe(,A)=N"?Spacc<widc(i)-Esizc(name(i)+ElseIflyPeC&l")二D”?ImElse77Spacc(widc(i>-l-cn(*>÷,"EndifEndifi=i+lEnddoSkipI行数=行数+2EnddoEnddoIftfft<>1.inest2÷lQ»1.i=lDoWhiIci<End?RePIiCate("-"Nide(M)+-i=i+lEnddo?RCPIiCalc(“一”.Wide(巾2)+”w?SPaCe(10)+,第FSIr(页页''Space(IH"SuyPages,2>÷“页”IfSizc>60?SPaeGSiZd60+'制表日191:*+Str(YCar(DatCO),4计“年.+;STR(Momh(Da3)+“月>Str(Day(DatcO),2)÷"1.rEndifEndifSetPrinterOffUseReturn