我正在尝试检测powerpoint演示文稿的当前缩放。以下是我刚刚编写的代码:
Microsoft.Office.Interop.PowerPoint.Application application = new Microsoft.Office.Interop.PowerPoint.Application();
Presentation presentation = application.Presentations.Open(file_name);
application.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;
if (document.SlideShowWindow.View.Zoom == 90) { blah }
我收到以下错误,无法解决原因:
An exception of type 'System.Runtime.InteropServices.COMException' occurred in ICTeacher.exe but was not handled in user code
Additional information: Presentation (unknown member) : Invalid request. There is currently no slide show view for this presentation.
导致错误的行是document.SlideShowWindow.View.Zoom == 90
我做错了什么?
答案 0 :(得分:0)
解决了,我需要:Application.ActiveWindow.View.Zoom
而不是document.SlideShowWindow.View.Zoom
。