Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Embed PowerPoint Viewer in C# Win Form

Tags:

c#

powerpoint

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?

like image 905
Soppus Avatar asked Aug 11 '09 09:08

Soppus


People also ask

How do I embed a PowerPoint file?

Open your presentation in PowerPoint for the web. On the File tab of the Ribbon, click Share, and then click Embed. In the Embed box, under Dimensions, select the correct dimensions for the blog or web page. Under Embed Code, right-click the code, click Copy, and then click Close.

How do I insert a web viewer in PowerPoint?

You can find this by going to the Insert tab within PowerPoint, and from there clicking Get Add-ins. At that point, you will see a window open up, where you can search for web viewer. Once installed, a web viewer frame will be inserted into your current slide.

Can I use embed code in PowerPoint?

In PowerPoint, go to the slide where you want to insert the content. On the toolbar ribbon, select the Insert tab, select Video, and then select Online Video. The Insert Video dialog box opens. Paste the embed code in the box named From a Video Embed Code, and then press Enter.

Can you use iFrame in PowerPoint?

In PowerPoint, if you want to directly check web pages from your slide show, you can embed iFrame code to this PowerPoint, and then you can keep the flow of your PowerPoint presentation and display a web object at the same time.


3 Answers

See this link. You can also display the ppt in a WebBrowser control. This might also be useful.

like image 126
danish Avatar answered Oct 18 '22 08:10

danish


Thanks for good links, http://support.microsoft.com/kb/304662 has useful info... That helped me :)

like image 22
Pasan Indeewara Avatar answered Oct 18 '22 07:10

Pasan Indeewara


For placement change the objPres.SlideShowWindow.Top to 10 as example and objPres.SlideShowWindow.Left to 12 so the upper left corner of the slide will be at (12,10) where left move it horizontal and the top move it down vertically.

like image 20
Dodo Avatar answered Oct 18 '22 08:10

Dodo