C#打开Powerpoint

//需要引入COM组件:

//项目->添加引用->com->microsoft office object libraty

//项目->添加引用->com->microsoft powerpoint object libraty

//功能:打开PPT某一页

//参数:filePath: PPT路径;pageIndex:指定打开的页码

        private void GotoSlide(string filePath, int pageIndex)
        {    
               Microsoft.Office.Interop.PowerPoint.Application PPTApplication = new Microsoft.Office.Interop.PowerPoint.Application();
                //以非只读方式打开,方便操作结束后保存.
               Presentation PPTPresentation = PPTApplication.Presentations.Open(filePath, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);
               SlideShowSettings slideShow = PPTPresentation.SlideShowSettings;             
               slideShow.Run();
               PPTPresentation.SlideShowWindow.View.GotoSlide(pageIndex);           
        }

http://blog.sina.com.cn/s/blog_6b2e32770100xrlf.html

http://outofmemory.cn/code-snippet/33373/C-operation-PowerPoint-basic-code

你可能感兴趣的:(C#)