1. Using fwrite() to create a prn file.
The file is then picked up in excel. THe file is created but no data in it. 0 bits. Worked fine in 16 bit not working at all now. Any help is welcome.
Code below.
2. I tried the using oBrw:toexcel() and it worked pretty good however it entered the last line of the browse 600 times. Once for each record.
Help here would be great.
- Code: Select all Expand view
ftitle := fieldname(2)
fty13 := fieldname(55)
fty1 := fieldname(43)
fty2 := fieldname(44)
fty3 := fieldname(45)
fty4 := fieldname(46)
fty5 := fieldname(47)
fty6 := fieldname(48)
fty7 := fieldname(49)
fty8 := fieldname(50)
fty9 := fieldname(51)
fty10 := fieldname(52)
fty11 := fieldname(53)
fty12 := fieldname(54)
faa14 := Fieldname(82)
go top
plfile := "pl"+substr(gld,5,2)+".prn"
fcreate(plfile, FC_NORMAL) // create a new file
nHandle := fopen(plfile, FO_READWRITE)
go top
fwrite(nHandle,upper(mcompname)+CRLF+CRLF)
fwrite(nHandle, "Account" + space(30) + "Total" + space(10) +;
m1 + space(10) + ;
m2 + space(10) + ;
m3 + space(10) + ;
m4 + space(10) + ;
m5 + space(10) + ;
m6 + space(10) + ;
m7 + space(10) + ;
m8 + space(10) + ;
m9 + space(10) + ;
m10 + space(10) + ;
m11 + space(10) + ;
m12 + space(10) + ;
"%" + CRLF)
do while .not. eof()
down := down + 1
if title = "==============================" .OR. title = "------------------------------"
fwrite(nHandle,space(30))
fwrite(nhandle,SPACE(5) + trans(&fty13,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&fty1 ,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&fty2 ,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&fty3 ,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&fty4 ,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&fty5 ,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&fty6 ,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&fty7 ,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&fty8 ,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&fty9 ,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&fty10,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&fty11,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&fty12,repli("_",11)))
fwrite(nHaNdle,SPACE(2) + trans(&faa14,repli("_",9)+ CRLF ))
skip
elseif !EOF()
fwrite(nHandle, &ftitle)
fwrite(nhandle, SPACE(2) + trans(&fty13, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&fty1, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&fty2, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&fty3, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&fty4, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&fty5, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&fty6, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&fty7, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&fty8, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&fty9, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&fty10, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&fty11, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&fty12, "999,999,999") )
fwrite(nHaNdle, SPACE(2) + trans(&faa14, "999,999.99") + CRLF )
skip
endif
enddo
fclose(nhandle)
return nil
// end function plascii()