Embed PowerPoint Viewer in C# Win Form

Posted by Soppus on Stack Overflow See other posts from Stack Overflow or by Soppus
Published on 2009-08-11T09:43:33Z Indexed on 2010/03/24 15:23 UTC
Read the original article Hit count: 1411

Filed under:
|

Is it possible to Embed a PowerPoint Viewer into a C# Windows Form?

I am currently use the following code:

objApp = new PowerPoint.Application();
        //objApp.Visible = MsoTriState.msoTrue;
        objPresSet = objApp.Presentations;
        objPres = objPresSet.Open(ppsAction.FileInfo.FullName, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
        objSlides = objPres.Slides;

        //Run the Slide show
        objSSS = objPres.SlideShowSettings;
        objSSS.ShowType = Microsoft.Office.Interop.PowerPoint.PpSlideShowType.ppShowTypeSpeaker;
        objSSS.LoopUntilStopped = MsoTriState.msoTrue;
        objSSS.Run();

        WindowWrapper handleWrapper = new WindowWrapper(objPres.SlideShowWindow.HWND);
        SetParent(handleWrapper.Handle, this.ApplicationPanel.Handle);
        this.ApplicationPanel.Visible = true;
        objPres.SlideShowWindow.Height = ApplicationPanel.Height;
        objPres.SlideShowWindow.Width = ApplicationPanel.Width;
        objPres.SlideShowWindow.Top = 0;
        objPres.SlideShowWindow.Left = 0;

It shows the viewer on the form but the placement and sizing is wrong. How would one size and place it correctly.

Another option:
I have encountered the Aximp.exe application meant to be used for showing ActiveX controls on the Win Forms in C#. How would I use this with the PPT Viewer?

© Stack Overflow or respective owner

Related posts about c#

Related posts about powerpoint