locked
How to get IViewObject interface of the office document? RRS feed

  • Question

  • Hi,

     How can I get IViewObject interface for the Powerpoint presentations (slideshow) that I load from my code?

    The following code throws casting exception.

    I will use IViewObject::Draw method to draw to a memory DC to convert the slideshow to video.

    Thanks in advance.

    using Microsoft.Office.Core; 
    using Microsoft.Office.Interop.PowerPoint; 
    using Microsoft.VisualStudio.OLE.Interop; 
     
                Microsoft.Office.Interop.PowerPoint.Application oApp; 
                oApp = new Microsoft.Office.Interop.PowerPoint.Application(); 
                // animation load & slideshow playback code here 
     
               IViewObject vo; 
     
               vo = (IViewObject)(oApp.ActivePresentation);  // THROWS EXCEPTION 
     

    Friday, January 30, 2009 1:45 AM

Answers