foxpro:将表写入excel

oleApp = CREATEOBJECT("Excel.Application")
oleapp.workbooks.add
oleapp.visible=.t.
SELECT ls
*写入表的标题
oleapp.cells(1,10).value="这是我的表"
*oleapp.cells(1,10).font.fontname="黑体"
oleapp.cells(1,10).font.size=24
nfieldcount=AFIELDS(alist)
nreccount=RECCOUNT()
*先写字段名
FOR j=1 TO nfieldcount
oleapp.cells(2,j).value=FIELD(j)
ENDfor
*写入字段值
i=1
scan
 FOR j=1 TO nfieldcount
  
   oleapp.cells(i+2,j)=trans(eval(alist(j,1)))
     
 ENDFOR
i=i+1 
endscan
OleApp.ActiveWorkbook.SaveAs("c:\TEMP.XLS")
oleapp.quit

你可能感兴趣的:(职场,Excel,休闲,FoxPro)