C#打开Powerpoint

时间:2015-07-31 18:34:16   收藏:0   阅读:886

//需要引入COM组件:

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

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

//功能:打开PPT某一页

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

    <span style="font-size:12px;">    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);           
        }</span>

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

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

版权声明:本文为博主原创文章,未经博主允许不得转载。

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!