SET TALK OFF
SET SAFETY OFF
CLOSE DATABASES
CLEAR ALL
cDefpath=ADDBS(JUSTPATH(SYS(16)))
SET DEFAULT TO (cDefpath)
CREATE TABLE tt (编号 C(10), 姓名 C(10), 出生年月 C(10), 语文 I, 数学 I, 英语 I)
oWord=CREATEOBJECT("word.application")
FOR i=1 TO ADIR(c_File,"*.doc")
oDoc=oWord.Documents.OPEN(cDefpath+"\"+c_File(i,1))
oTab=oDoc.tables(1)
FOR j=1 TO 2
k=2
DO WHILE k<32
txt=trim(oTab.Cell(k,(j-1)*6+1).RANGE.TEXT,0h0d,0h07,0h20)
IF empty(txt) && 对编号进行空值判断
EXIT
ENDIF
INSERT INTO tt VALUES (;
ALLTRIM(oTab.Cell(k,(j-1)*6+1).RANGE.TEXT,0h0d,0h07,0h20),;
ALLTRIM(oTab.Cell(k,(j-1)*6+2).RANGE.TEXT,0h0d,0h07,0h20),;
ALLTRIM(oTab.Cell(k,(j-1)*6+3).RANGE.TEXT,0h0d,0h07,0h20),;
VAL(oTab.Cell(k,(j-1)*6+4).RANGE.TEXT),;
VAL(oTab.Cell(k,(j-1)*6+5).RANGE.TEXT),;
VAL(oTab.Cell(k,(j-1)*6+6).RANGE.TEXT))
k=k+1
ENDDO
ENDFOR
oDoc.CLOSE
ENDFOR
oWord.QUIT
SELECT * FROM tt
红色标出的几句不起作用,不知为何?
[此贴子已经被作者于2021-12-22 17:16编辑过]