>******************************************************************** >* Description.......: RemovePrinterSpecificInfo - Removes printer specific settings in report form >* Calling Samples...: RemovePrinterSpecificInfo('All') >* Parameter List....: pRepoForm >* Created by........: Yuri Rubinov July 2000 >* Modified by.......: Nadya Nosonovsky 01/11/2002 01:51:06 PM >******************************************************************** >parameter pRepoForm >local ia >if vartype(pRepoForm)#"C" > pRepoForm=getfile("frx") >endif > >do case >case upper(m.pRepoForm)#"ALL" > pRepoForm=forceext(m.pRepoForm,"frx") > > if not file(m.pRepoForm) > =messagebox("Report Form "+ m.pRepoForm +" not found?!",48,'Not found') > return .f. > endif > do iClean >otherwise > local array aa[1] > local lcPath, lcFilter, DTitle, lcReportDir, lnFiles > lcReportDir = '\redp\dbc\jobs\Reports' > lcPath ='' > DTitle = "Select Report Files to Remove Printer Specific Info..." >* Text (*.txt)|*.txt|Pictures (*.bmp;*.ico)|*.bmp;*.ico > lcFilter = "Report Files (*.frx)|*.frx|All Files (*.*)|*.*" > lnFiles = File_Chooser(@aa, @lcPath, m.DTitle, m.lcReportDir, m.lcFilter) > if m.lnFiles = 0 && User chooses Cancel > return .f. > endif >*!* >*!* if adir(aa,"*.frx")<=0 >*!* =messagebox("No *.frx Report Forms found?!") >*!* return >*!* endif > =asort(aa) > for ia =1 to m.lnFiles > pRepoForm=addbs(m.lcPath)+aa[m.ia] > do iClean > endfor >endcase > >*---------------------------------- >procedure iClean >local lcExpr, lnLines, lnI, CR >close table all >use (m.pRepoForm) >wait wind time 0.5 "Report form "+dbf() >=afields(afld) >CR=chr(13) >* the very first record only >if ascan(afld,"TAG")#0 and ascan(afld,"TAG2")#0 and ascan(afld,"EXPR")#0 > go top >*keep orientation and other stuff > lnLines = alines(laLines,expr,.t.) > lcExpr = "" > for lnI = 1 to m.lnLines > if "DEVICE" $ upper(laLines[m.lnI]) or "DRIVER" $ upper(laLines[m.lnI]) or "OUTPUT" $ upper(laLines[m.lnI]) > && this record should be removed > else > if "DEFAULTSOURCE" $ upper(laLines[m.lnI]) > laLines[m.lnI] = "DEFAULTSOURCE=7" > endif > lcExpr = m.lcExpr + laLines[m.lnI]+ m.CR > endif > next >*!* if "orientation"$lower(expr) >*!* lcOrient=substr(expr,at("orientation=",lower(expr))) && Remove the begining of the Expr field >*!* endif > replace tag with "", tag2 with "", expr with m.lcExpr >else > =messagebox("File "+m.pRepoForm+". Not VFP6 format?!") >endif >use >*----------------- >>
>>>>lparameters lcfile >>>>IF PCOUNT()>0 and file(lcFile) >>>> modi repo (lcFile) >>>> USE (lcFile) >>>> REPLACE EXPR WITH "", TAG WITH "", TAG2 WITH "" >>>> USE >>>>ENDIF>>>>