Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP 3.0 REPORT TO FILE ASCII
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00087239
Message ID:
00087636
Views:
28
>>>I'm using Roman 10cpi font for my report. On printing the data to the printer the report prints out fine, however on reporting to file it is observed that some the lines overlap. I'm not being able to figure thsi out and any suggestions would be helpfull.
>>>
>>>Thanks
>>>
>>>Sonali
>>If you mean some extra CR you may try following code (It's an old code for FP 2x and might need revision).
>>function rep2file
>>parameters orgfile
>>moldsel=alias()
>>create cursor tempcurs (fle m(10))
>>insert into tempcurs values (" ")
>>append memo fle from (ORGFILE)
>>replace fle with ;
>> STRTRAN(CHRTRAN(STRTRAN(strtran(;
>> fle,chr(12),"%%");
>> ,CHR(13)+CHR(10),"%%");
>> ,CHR(13),"þ");
>> ,"%%",CHR(13)+CHR(10))
>>
>>mtempfile="F"+substr(sys(3),2)+".txt"
>>copy memo fle to (mtempfile)
>>use
>>select (moldsel)
>>handle=fopen(mtempfile)
>>ifp_size=fseek(handle,0,2)
>>=fseek(handle,0,0)
>>HANDLE1=FCREATE(orgfile)
>>DO WHILE !FEOF(HANDLE)
>> =FPUTS(HANDLE1,SMOOTH(FGETS(HANDLE,ifp_size)),ifp_size)
>>ENDDO
>>=fclose(handle)
>>=fclose(handle1)
>>erase (mtempfile)
>>WAIT CLEAR
>>
>>FUNCTION SMOOTH
>>PARAMETERS LINE
>>IF OCCURS("þ",LINE)=0
>> RETURN LINE
>>ENDIF
>>DIMENSION LINES[OCCURS("þ",LINE)+1]
>>MXLEN=0
>>FOR OCCHAR=1 TO OCCURS("þ",LINE)
>> LINES[OCCHAR]=SUBSTR(LINE,1,AT("þ",LINE)-1)
>> LINE=SUBSTR(LINE,AT("þ",LINE)+1)
>> MXLEN=MAX(MXLEN,LEN(LINES[OCCHAR]))
>>ENDFOR
>>LINES[ALEN(LINES,1)]=LINE
>>MXLEN=MAX(MXLEN,LEN(LINE))
>>if mxlen=0
>> return ""
>>endif
>>for maxline=1 to ALEN(LINES,1)
>> lines[maxline]=padr(lines[maxline],mxlen+1," ")
>>endfor
>>for linenum=1 to ALEN(LINES,1)-1
>> for chrpos=1 to len(lines[ALEN(LINES,1)-linenum+1])
>> if substr(lines[ALEN(LINES,1)-linenum+1],chrpos)=" "
>> loop
>> endif
>> lines[ALEN(LINES,1)-linenum]=;
>> stuff(lines[ALEN(LINES,1)-linenum],chrpos,1,;
>> substr(lines[ALEN(LINES,1)-linenum+1],chrpos,1))
>> endfor
>>endfor
>>return lines[1]
>>
>>cetin
>
>No I don't mean extra CR's. I'm printing out Details regarding Companies, the Name,Address of the Company ( Group Band ) followed by details of the Band ( Detail Band ). What is observed is that randomly the Name is overwritten by the Address when I Report to FILE ASCI. On sending the report to a printer everything is fine. Could it be a VFP 3.0 bug?
>
>Thanks
>
>Sonali

Have you tried playing around with the _ASCIICOLS (and maybe _ASCIIROWS) environment variables? The default for _ASCIICOLS is 80, which is not usually wide enough if your report has a lot squeezed in. I needed 110 for one of mine. You might also try moving the two fields further apart.

I think that converting a graphic thing like a report to text will always be problematic. The simpler your report is, the better chance of a good conversion. It also helps to make sure your controls are sort of lined up with each other. It is up to you how much you compromise the look of the printed report in order to make the ASCII file look good. The results are probably more predictable if you are using a non-proportional font like Courier, but I wouldn't want to do that. You may also find that a text box that is just barely wide enough to contain a value will print correctly but truncate in the ASCII file.

I had one report which had many fields and printed landscape. I eventually gave up trying to make an ASCII file out of that one. If these files are very important, and if you have many kinds of reports to save, you might better give up on REPORT TO FILE ASCII and either use textmerge commands or start automating Word or Excel, depending on what the files are for. You could also try FoxWord, which saves to .RTF. I heard that it doesn't work in WIN NT, so I can't use that one.
Previous
Reply
Map
View

Click here to load this message in the networking platform