简体   繁体   中英

How to open a powerpoint within a WPF page

I'm currenlty trying to open a PowerPoint inside my WPF program. I would like to have it embedded into my page and also to use custom controls to the presentation (not the default user bar).

string FileName = "filePath";
Microsoft.Office.Interop.PowerPoint.Application application = new PowerPoint.Application();
application.SlideShowEnd += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowEndEventHandler(powerpnt_SlideShowEnd);
Microsoft.Office.Interop.PowerPoint.Presentation presentation = application.Presentations.Open2007(FileName, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue);
Microsoft.Office.Interop.PowerPoint.SlideShowSettings sst = presentation.SlideShowSettings;
sst.ShowType = Microsoft.Office.Interop.PowerPoint.PpSlideShowType.ppShowTypeSpeaker;
sst.Run();

The code is working and I can open the PPT Presentation, however, it is fullscreen and I can't find a way to handle the window...

Any idea?

To display the presentation into a wpf window you need a component. I don't know if there is any...

Usually the approch is the opposite: you embed your app into PowerPoint creating an addin (see Office Application Addin) and then you can also customize default PowerPoint interface removing controls and displaing yours.

You can use wpf too.

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