Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to fix REPORT TO ASCII bug (using frx2word?)
Message
 
 
To
13/01/2003 05:28:00
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00740915
Message ID:
00740975
Views:
25
Hi Andrus,

I've created a program, which can be considered as a draft for creating program of translating Report to Prg. The code is bellow, as you see, is very primitive, but may be it would help.:
*******************************************************************************************
*  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 vartype(tcReportFile)<>'C' or empty(m.tcReportFile)
    lcReportName=getfile("FRX")
else
    lcReportName=forceext(m.tcReportFile,"frx")
endif        
if empty(m.lcReportName) 
   return .f.
endif   
if !file(m.lcReportName) && Report file doesn't exist
    =messagebox("File "+m.lcReportName+" is not found!",48,"Error")
    return .f.
endif
if empty(m.tcProgramFile) or vartype(m.tcProgramFile)<>'C'
    lcProgramName=getfile("PRG")
else
    lcProgramName=forceext(m.tcProgramFile,"prg")
endif        
if file(m.lcProgramName)
   lnAnswer=messagebox("File "+m.lcProgramName+ " already exists. Do you want to re-create it?",36,"File exists")
   if m.lnAnswer=7 && No
      return .f.
   else
      erase (m.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=m.LcStr+"if "+alltrim(supexpr)+LCRF+ ;
     space(6)+m.lcBegin+alltrim(expr)+m.lcEnd+LCRF+"endif"+LCRF
  else
     lcStr=m.LcStr+m.lcBegin+alltrim(expr)+m.lcEnd+LCRF
  endif
endscan
*=messagebox(lcStr)
=strtofile(m.lcHeader+lcStr,m.lcProgramName)
You still have to modify this auto-generated program to produce desired result...

>I use a number of reports as templates to generate txt files using
>Those repors contain one field in each row with plenty of empty space
>between rows.
>
>I use the following command to create txt files :
>
>_ASCIICOLS=250
>REPORT FORM TO FILE ASCII
>
>In Windows 98 this works OK.
>In Windows 2000 some lines in output txt files are merged together in random places: first character in sime line is replaced by a first character from a second line.
>
>I realized that this is a VFP 7 bug. Since Microsoft will not fix VFP 7 bugs I'm looking for another solution.
>
>This solution must allow non-programmers to create a report templates and utility to generate a txt files from them.
>
>I'm looking to the following possibilites:
>
>1. Is it possible to modify frx2word so that it will generate txt files without using word ?
>
>frx interpretation and Word automation code is mixed in frx2word.
>
>There seems to be two possibilities: a) re-write frx2word separating word automation into separate class. This allows to add new drivers to frx2word to generate txt and html files.
>
>b) modify frx2word code to add txt file creation.
>
>Is this reasonable ?
>
>2. Is REPORT ... ASCII bug fixed in VFP 8 ?
>
>3. Or are there some free other solution ? I studied a txt file creation utilities in file area but have'nt found any utility which converts frx to txt file .
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform