Can't replace the footer text in a word applic

2019-07-19 17:21发布

I am trying to replace text in a footer, I am using the following code through which i can replace the normal content (body) but not the content in the footer/header

myWinWordApp := CreateOLEObject('Word.Application');
myWinWordApp.visible := true;
myWinWordApp.documents.open('c:\ole.doc');
myWinWordApp.Selection.Find.Text :=  'oo';
myWinWordApp.selection.Find.Replacement.Text := 'aa';
myWinWordApp.Selection.Find.Execute(Replace := 2);

any help is highly appreciated. Thanks in advance

1条回答
淡お忘
2楼-- · 2019-07-19 17:52

Made comment into answer:

I would try to set the view to the header/footer mode, maybe by doing something like ActiveWindow.ActivePane.View.SeekView := wdSeekCurrentPageHeader as shown here.

查看更多
登录 后发表回答