哦,谢谢版主
请教吹水佬版主
以下是引用吹水佬在2023-6-18 10:07:15的发言:
cPath = ADDBS(JUSTPATH(SYS(16)))
SET DEFAULT TO (cPath)
sc = CREATEOBJECT("ScriptControl")
sc.Language = "VBScript"
TEXT TO vbsCode TEXTMERGE NOSHOW PRETEXT 7
function fun(cFile)
dim excel
set excel = createobject("Excel.Application")
excel.workbooks.open(cFile)
excel.Cells.Replace ChrW(&hA0), ""
nRow = excel.sheets(1).UsedRange.Rows.Count
nCol = excel.sheets(1).UsedRange.Columns.Count
fun = excel.Cells(1,1).Resize(nRow,nCol).Value
excel.ActiveWorkBook.Saved = 1
excel.workbooks.close
excel.quit
end function
ENDTEXT
sc.AddCode(vbsCode)
arr = sc.Run("fun", cPath+"表格.xls")
CREATE CURSOR tt (f1 M)
INSERT INTO tt FROM ARRAY arr
SELECT * FROM tt
cPath = ADDBS(JUSTPATH(SYS(16)))
SET DEFAULT TO (cPath)
sc = CREATEOBJECT("ScriptControl")
sc.Language = "VBScript"
TEXT TO vbsCode TEXTMERGE NOSHOW PRETEXT 7
function fun(cFile)
dim excel
set excel = createobject("Excel.Application")
excel.workbooks.open(cFile)
excel.Cells.Replace ChrW(&hA0), ""
nRow = excel.sheets(1).UsedRange.Rows.Count
nCol = excel.sheets(1).UsedRange.Columns.Count
fun = excel.Cells(1,1).Resize(nRow,nCol).Value
excel.ActiveWorkBook.Saved = 1
excel.workbooks.close
excel.quit
end function
ENDTEXT
sc.AddCode(vbsCode)
arr = sc.Run("fun", cPath+"表格.xls")
CREATE CURSOR tt (f1 M)
INSERT INTO tt FROM ARRAY arr
SELECT * FROM tt
这段代码,当excel表格是数字无论单元格式是常规还是文本导入到字符型字段后,在数字后面加点和0.