嗯。非常感觉,参照4楼给的地址解决了,解决答案如下:
var
FileName: String;
o: Object;
app, docs, doc : System.DispatchHelper;
field,Item :system.dispatchHelper;
begin
FileName := 'c:\A.doc';
o := ComObj.CreateOleObject('Word.Application');
app := DispatchHelper.Create(o);
app.PropertyPut('Visible', [True]);
docs := DispatchHelper.Create(app.PropertyGet('Documents', []));
docs.InvokeMethod('Add', [FileName,False]);
doc := System.DispatchHelper.Create(app.PropertyGet('ActiveDocument',[]));
field := System.DispatchHelper.Create(doc.PropertyGet('FormFields',[]));
Item := System.DispatchHelper.crate(Field.InvokeMethod('item',['DBR']));
Item.PropertyPut('Result',['1234567890']); |