团队!
我的 Visual Studio 2008 中有一个 MS Powerpoint 加载项项目,使用 C#。我使用以下代码从 Powerpoint 演示文稿中读取页脚的文本:
String currentFooterText =
Application.ActivePresentation.SlideMaster.HeadersFooters.Footer.Text;
(其中 Application 类来自命名空间Microsoft.Office.Interop.PowerPoint.Application
)
当我加载一个 ppt 文件(97-2003 演示类型)时,代码能够访问插入到幻灯片页脚属性中的文本(菜单视图>页眉和页脚...>幻灯片>页脚)。
但是,当我加载一个 pptx 文件(在 Powerpoint 2007 或 2010 中创建的演示文稿)时,代码无法访问也插入到幻灯片页脚属性中的文本(菜单插入>页眉和页脚...>幻灯片> 页脚)。Text 返回一个空白文本。
请问,有人对此有任何想法吗?这些 Powerpoint 版本之间是否存在不兼容的页脚访问?
史蒂夫!
谢谢回复!
事实上,我的代码在 Visual Studio 2008 上,用于 Powerpoint 2003 插件项目。当我打开一个 pptx 文件时,就会出现问题。
我尝试了您的建议,但使用括号而不是括号,如下所示:
字符串 s = Application.ActivePresentation.Designs[1].SlideMaster.HeadersFooters.Footer.Text;
但是问题仍然存在,对于 pptx 文件,Text 仍然返回空。它适用于ppt,就像以前一样。您是否知道在 VS 2008 上使用任何编程方式,用于 Powerpoint 2003 插件项目,以访问 pptx 文件的页脚文本?
谢谢!