用Visual Fox Pro V6.0是否能将一个很大的DBF文件转化成几个小的excel文件
用VisualFoxProV6.0是否能将一个很大的DBF文件转化成几个小的excel文件,因为只转化到一个excel表格里装不下,因为信息超过了6万5千条...
用Visual Fox Pro V6.0是否能将一个很大的DBF文件转化成几个小的excel文件,因为只转化到一个excel表格里装不下,因为信息超过了6万5千条
展开
2个回答
展开全部
使用copy命令将dbf保存为xls文件时最大只能导出6万5千条,如果想完整导出,可以使用如下办法。
(编程方式导出表中数据到XLS文件,灵活性高,导出记录的数量没有限制)
USE LSBOOK
lcFileName="C:\图书资料.XLS"
LOCAL lOldSetOpt,mChanNum &&下面语句判断EXCEL或要保存的EXCEL文件是否已经打开
lOldSetOpt = DDESetOption("SAFETY")
= DDESetOption("SAFETY",.F.)
**mChanNum = DDEInitiate('Excel','SYSTEM') &&EXCEL是否已经打开
mChanNum = DDEInitiate('Excel','&lcFileName') &&lcFileName某XLS文件名,如:D:\123.XLS
IF mChanNum <> -1
**= messagebox('程序 EXCEL 已经打开,请先将其关闭!',64,'系统提示!')
= messagebox('文件【'+lcFileName+'】已经打开,请先将其关闭!',64,'系统提示!')
= DDETerminate(mChanNum)
= DDESetOption("SAFETY",lOldSetOpt)
RETURN
ENDIF
IF FILE(lcFileName)
DELETE FILE &lcFileName
ENDIF
eole=CREATEOBJECT("Excel.application")
eole.Workbooks.add
eole.Worksheets("sheet1").Activate
*eole.visible=.t.
eole.cells(1,1)="书号"
eole.cells(1,2)="自编号"
eole.cells(1,3)="书名"
eole.cells(1,4)="作者"
eole.cells(1,5)="出版社"
eole.cells(1,6)="定价"
eole.cells(1,7)="折扣"
eole.cells(1,8)="出版年限"
SCAN
i=RECNO()
eole.cells(i+1,1)="'"+ALLTRIM(isbn)
eole.cells(i+1,2)=ALLTRIM(selfcode)
eole.cells(i+1,3)=ALLTRIM(booktitle)
eole.cells(i+1,4)=ALLTRIM(author)
eole.cells(i+1,5)=ALLTRIM(pubname)
eole.cells(i+1,6)=price
eole.cells(i+1,7)=IIF(Discount+M_ZK>1,1,Discount+M_ZK)
eole.cells(i+1,8)=IIF(ISNULL(PubDate),"",TTOD(Pubdate))
ENDSCAN
USE
eole.ActiveWorkbook.SaveAs(lcFileName)
eole.Workbooks.close
eole.quit
=MESSAGEBOX("已生成【"+lcFileName+"】文件!",0+64,"恭喜")
(编程方式导出表中数据到XLS文件,灵活性高,导出记录的数量没有限制)
USE LSBOOK
lcFileName="C:\图书资料.XLS"
LOCAL lOldSetOpt,mChanNum &&下面语句判断EXCEL或要保存的EXCEL文件是否已经打开
lOldSetOpt = DDESetOption("SAFETY")
= DDESetOption("SAFETY",.F.)
**mChanNum = DDEInitiate('Excel','SYSTEM') &&EXCEL是否已经打开
mChanNum = DDEInitiate('Excel','&lcFileName') &&lcFileName某XLS文件名,如:D:\123.XLS
IF mChanNum <> -1
**= messagebox('程序 EXCEL 已经打开,请先将其关闭!',64,'系统提示!')
= messagebox('文件【'+lcFileName+'】已经打开,请先将其关闭!',64,'系统提示!')
= DDETerminate(mChanNum)
= DDESetOption("SAFETY",lOldSetOpt)
RETURN
ENDIF
IF FILE(lcFileName)
DELETE FILE &lcFileName
ENDIF
eole=CREATEOBJECT("Excel.application")
eole.Workbooks.add
eole.Worksheets("sheet1").Activate
*eole.visible=.t.
eole.cells(1,1)="书号"
eole.cells(1,2)="自编号"
eole.cells(1,3)="书名"
eole.cells(1,4)="作者"
eole.cells(1,5)="出版社"
eole.cells(1,6)="定价"
eole.cells(1,7)="折扣"
eole.cells(1,8)="出版年限"
SCAN
i=RECNO()
eole.cells(i+1,1)="'"+ALLTRIM(isbn)
eole.cells(i+1,2)=ALLTRIM(selfcode)
eole.cells(i+1,3)=ALLTRIM(booktitle)
eole.cells(i+1,4)=ALLTRIM(author)
eole.cells(i+1,5)=ALLTRIM(pubname)
eole.cells(i+1,6)=price
eole.cells(i+1,7)=IIF(Discount+M_ZK>1,1,Discount+M_ZK)
eole.cells(i+1,8)=IIF(ISNULL(PubDate),"",TTOD(Pubdate))
ENDSCAN
USE
eole.ActiveWorkbook.SaveAs(lcFileName)
eole.Workbooks.close
eole.quit
=MESSAGEBOX("已生成【"+lcFileName+"】文件!",0+64,"恭喜")
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询