How to open a remote ppt file by Microsoft.Office.Interop.PowerPoint?

已答复 How to open a remote ppt file by Microsoft.Office.Interop.PowerPoint?

  • 2011年12月2日 5:38
     
      包含代码

    Hi all

    I want to run a ppt file using c#, 32 bit Os,  windows 7. 

    Part of the code is as follows:

                //Create a new presentation based on a template.
                objApp = new PowerPoint.Application();
                objApp.Visible = MsoTriState.msoTrue;
                objPresSet = objApp.Presentations;
                string strPath = @"\\192.168.31.164\isoftShare\123.ppt";
                objPres = objPresSet.Open(strPath, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoFalse);
                objSlides = objPres.Slides;
    
                //Run the Slide
                objSSS = objPres.SlideShowSettings;
                objSSS.Run();
    
                //Wait for the slide show to end.
                objSSWs = objApp.SlideShowWindows;
                while (objSSWs.Count >= 1) System.Threading.Thread.Sleep(100);
    


    Here if the ppt file path (strPath) is the local file like "C:\123.ppt" then is no problem, but if the file path is a network path like "\\192.168.31.164\share\123.ppt" When I run my application COMException (0x80004005): PowerPoint could not open the file.

    if i open the "\\192.168.31.164\share\123.ppt" file manually by the Office PowerPoint 2007, it also work. but why use C# can't?

    I did a lot of googling but problem could not be resolved.

    Please help


    jakeyjia

全部回复