简体   繁体   中英

Getting the current zoom of a powerpoint presentation

I am trying to detect the current zoom of a powerpoint presentation. The following is the code I have just written:

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 }

I'm getting the following error and can't work out why:

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.

The line causing the error is document.SlideShowWindow.View.Zoom == 90

What am I doing wrong?

解决了,我需要: Application.ActiveWindow.View.Zoom而不是document.SlideShowWindow.View.Zoom

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM