如何从Excel中建立DBF数据表
Excel表格中第1行为建立Dbf的字段,从第2行开始为Dbf的记录,如何用编程形式将Excel表格转换为Dbf数据表,谢谢!如表:
Excel导入Dbf测试数据.zip
(7.74 KB)
cFileName = SYS(5) + SYS(2003) + "\Excel导入Dbf测试数据.xls" oExcel = CreateObject("Excel.Application") WITH oExcel .WorkBooks.Open(cFileName) .ActiveSheet.UsedRange.Columns.AutoFit nCols = .ActiveSheet.UsedRange.Columns.Count cStru = "" FOR ii = 1 TO nCols nWidth = INT(.ActiveSheet.Columns(ii).ColumnWidth) cStru = cStru + IIF(EMPTY(cStru), "", ",") + .ActiveSheet.Cells(1, ii).Text + " C(" + TRANSFORM(nWidth) + ")" ENDFOR .DisplayAlerts = .F. .ActiveWorkbook.SaveAs(cFileName, 39) .DisplayAlerts = .T. .QUIT RELEASE oExcel ENDWITH CREATE CURSOR Cssj (&cStru) APPEND FROM Excel导入Dbf测试数据 TYPE XL5 SELECT * FROM Cssj WHERE RECNO() > 1
[此贴子已经被作者于2019-1-5 14:32编辑过]
[此贴子已经被作者于2019-1-5 18:36编辑过]
[此贴子已经被作者于2019-1-7 12:42编辑过]