Can't replace the footer text in a word application through Delphi

瘦欲@ 提交于 2020-01-04 11:11:34

问题


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:


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.



来源:https://stackoverflow.com/questions/5637667/cant-replace-the-footer-text-in-a-word-application-through-delphi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!