******************************************************************************************* * Description.......: ReportToAscii - this program uses ReportFile as Input Table * and results a program to produce the same Output (as Report should produce) * Calling Samples...: ReportToAscii("Galley","g:\redp\appl\Special\Progs\GalleyRpt.prg") * Parameter List....: tcReportFile, tcProgramFile * Created by........: Nadya Nosonovsky 12/22/2000 10:09:26 AM * Modified by.......: ******************************************************************************************** lparameters tcReportFile, tcProgramFile local lcReportName, lcProgramName, lnAnswer if empty(tcReportFile) or vartype(tcReportFile)<>'C' lcReportName='Galley.frx' else lcReportName=forceext(tcReportFile,"frx") endif if !file(lcReportName) && Report file doesn't exist =messagebox("File "+lcReportName+" is not found!",48,"Error") return .f. endif if empty(tcProgramFile) or vartype(tcProgramFile)<>'C' lcProgramName='Galley.prg' else lcProgramName=forceext(tcProgramFile,"prg") endif if file(lcProgramName) lnAnswer=messagebox("File "+lcProgramName+ " already exists. Do you want to re-create it?",36,"File exists") if lnAnswer=7 && No return .f. else erase (lcProgramName) endif endif local lcStr, lcHeader, lcBegin, lcEnd select expr, supexpr, vpos, hpos from (lcReportName) ; into cursor curReport where inlist(objtype,5,8) order by 3,4 #define LCRF chr(10) lcStr='' lcHeader="#define LCRF chr(10)"+LCRF+"local lcStr"+LCRF+"* Open table here, then scan ... endscan ..."+LCRF lcBegin="lcStr=lcStr+" lcEnd="+LCRF" scan if not empty(supexpr) lcStr=LcStr+"if "+alltrim(supexpr)+LCRF+ ; space(6)+lcBegin+alltrim(expr)+lcEnd+LCRF+"endif"+LCRF else lcStr=LcStr+lcBegin+alltrim(expr)+lcEnd+LCRF endif endscan *=messagebox(lcStr) =strtofile(lcHeader+lcStr,lcProgramName)