请教vfp报表程序问题
下载了一个报表打印程序,在a(k)=field(k)有问题(显示“找不到变量”),请版主、高手指点。set talk off
hh1=printstatus()
set print on
do while .not.hh1
?\"打印机未准备好,请准备好打印机\"
hh1=printstatus()
enddo
set talk off
set device to print
clear
a1=getfile("dbf")
use "&a1"
n1=fcount()
dimension a(n1)
dimension b(n1)
k=1
do while k<=n1
a(k)=field(k)
enddo
w=1
do while w<=n1
b(w)=fsize(a(w))
if b(w)<6
b(w)=8
else
b(w)=b(w)+2
endif
w=w+1
enddo
do while not eof()
r1=1
m=1
col1=1
do while m<=n1
if m=1
@r1,col1 say \"┌\"+replicate(\"-\",b(m))
else
if m=n1
@r1,col1 say \"┬\"+replicate(\"-\",b(m))+\"┐\"
else
@r1,col1 say \"┬\"+replicate(\"-\",b(m))
endif
endif
col1=col1+b(m)
m=m+1
enddo
m=1
col1=1
do while m<=n1
if m=1
@r1+1,col1 say \"∣\"+substr(a(m),1,6)+replicate(\" \",(b(m)-len(a(m))))
else
if m=n1
@r1+1,col1 say \"∣\"+substr(a(m),1,6)+replicate(\" \",(b(m)-len(substr(a(m),1,6))))+\"∣\"
else
@r1+1,col1 say \"∣\"+substr(a(m),1,6)+replicate(\" \",(b(m)-len(substr(a(m),1,6))))
endif
endif
col1=col1+b(m)
m=m+1
enddo
m=1
col1=1
do while m<=n1
if m=1
@r1+2,col1 say \"∣\"+substr(a(m),7)
else
if m=n1
@r1+2,col1 say \"∣\"+substr(a(m),7)+replicate(\" \",(b(m)-len(substr(a(m),7))))+\"∣\"
else
@r1+2,col1 say \"∣\"+substr(a(m),7)
endif
endif
col1=col1+b(m)
m=m+1
enddo
m=1
col1=1
do while m<=n1
if m=1
@r1+3,col1 say \"├\"+replicate(\"-\",b(m))
else
if m=n1
@r1+3,col1 say \"┼\"+replicate(\"-\",b(m))+\"┤\"
else
@r1+3,col1 say \"┼\"+replicate(\"-\",b(m))
endif
endif
col1=col1+b(m)
m=m+1
enddo
row1=r1+4
do while .not.eof()
m=1
col1=1
do while m<=n1
if type(a(m))=\"C\"
if m=1
@row1,col1 say \"∣\"+&a(m)
else
if m=n1
@row1,col1 say \"∣\"+alltrim(&a(m))+replicate(\" \",(b(m)-len(alltrim(&a(m)))))+\"∣\"
else
@row1,col1 say \"∣\"+&a(m)
endif
endif
else
if m=1
@row1,col1 say \"∣\"+str(&a(m))
else
if m=n1
@row1,col1 say \"∣\"+alltrim(str(&a(m)))+replicate(\" \",(b(m)-len(alltrim(str(&a(m))))))+\"∣\"
else
@row1,col1 say \"∣\"+alltrim(str(&a(m)))
endif
endif
endif
col1=col1+b(m)
m=m+1
enddo
SKIP
if eof()
m=1
col1=1
do while m<=n1
if m=1
@row1+1,col1 say \"└\"+replicate(\"-\",b(m))
else
if m=n1
@row1+1,col1 say \"┴\"+replicate(\"-\",b(m))+\"┘\"
else
@row1+1,col1 say \"┴\"+replicate(\"-\",b(m))
endif
endif
col1=col1+b(m)
m=m+1
enddo
h=\".f.\"
exit
else
if r1=20
m=1
col1=1
do while m<=n1
if m=1
@row1+1,col1 say \"└\"+replicate(\"-\",b(m))
else
if m=n1
@row1+1,col1 say \"┴\"+replicate(\"-\",b(m))+\"┘\"
else
@row1+1,col1 say \"┴\"+replicate(\"-\",b(m))
endif
endif
col1=col1+b(m)
m=m+1
enddo
r1=1
eject
exit
else
m=1
col1=1
do while m<=n1
if m=1
@row1+1,col1 say \"├\"+replicate(\"-\",b(m))
else
if m=n1
@row1+1,col1 say \"┼\"+replicate(\"-\",b(m))+\"┤\"
else
@row1+1,col1 say \"┼\"+replicate(\"-\",b(m))
endif
endif
col1=col1+b(m)
m=m+1
enddo
endif
ENDIF
row1=row1+2
r1=r1+1
enddo
enddo
set print off
set device to screen
use
set talk on
return