无法通过Delphi替换Word应用程序中的页脚文本 [英] Can't replace the footer text in a word application through Delphi

查看:137
本文介绍了无法通过Delphi替换Word应用程序中的页脚文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试替换页脚中的文本,我正在使用以下代码,通过该代码我可以替换正常内容(正文),但不能替换页脚/页眉中的内容

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

推荐答案

在评论中添加注释:

我会尝试将视图设置为页眉/页脚模式,例如通过执行ActiveWindow.ActivePane.View.SeekView := wdSeekCurrentPageHeader之类的方法,如

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.

这篇关于无法通过Delphi替换Word应用程序中的页脚文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆