把WORD的内容读到MEMO1中,在写如数据库
uses comobj
procedure Tform1.button1click(Sender: TObject);
var
NewDoc:variant;
V: OleVariant;
FileNameTemp:String;
begin
if fileexists('c:/a.doc) then
begin
try
FileNameTemp :='c:/a.doc' ;
V := CreateOleObject('Word.Application');
NewDoc :=V.Documents.Open(FileNameTemp);
NewDoc.SaveAs(FileName :='C:/TEMP.rtf',FileFormat:=3);
NewDoc.Close;
V.Quit;
Memo1.Lines.Clear;
Memo1.Lines.LoadFromFile('C:/TEMP.rtf');
deletefile('C:/TEMP.rtf');
except
showmessage('c:/a.doc 可能已打开');
end;
end;
end;