在打开word中插入对象。 高手救命 ( 积分: 24 )

  • 主题发起人 icescream
  • 开始时间
I

icescream

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TZN.Button2Click(Sender: TObject);
var
count,k:integer;
findtext, matchcase, matchwholeword, matchwildcards, matchsoundslike,
matchallwordforms, forward1, wrap, format, replacewith, replace,matchkashida,matchdiacritics,matchalefhamza,matchcontrol: olevariant;
myfile:eek:levariant;
begin
wordapplication1.Documents.

//count:=filedirstr.Count;
findtext:= 'Been replace text';// 1. 要插入的点。
matchcase := false;
matchwholeword := true;
matchwildcards := false;
matchsoundslike := false;
matchallwordforms := false;
forward1 := true;
wrap := wdfindcontinue;
format := false;
replacewith :='dkdd'; // 2. 要插入的内容。
replace := true;
matchkashida:=false;
matchdiacritics:=false;
matchalefhamza:=false;
matchcontrol:=false;

worddocument1.ConnectTo(framercontrol1.activedocument as _document);//framercontrol1 与wordapplication差不多。


worddocument1.range.find.execute(findtext, matchcase, matchwholeword,matchwildcards, matchsoundslike, matchallwordforms, forward1, wrap, format, replacewith, replace,matchkashida,matchdiacritics,matchalefhamza,matchcontrol);


上面是想实现在打开的word文件中替换对象。如果替换文字是可以的。
问题: 我想替换的对象是另一个.doc文件(此文件不被显示出来)。
 
顶部