如何在C#的帮助下使用Visual Studio 2013在多张幻灯片中拆分A * .Pptx文件? [英] How Do I Split A *.Pptx File In Multiple Slide Using Visual Studio 2013 By The Help Of C# ?

查看:86
本文介绍了如何在C#的帮助下使用Visual Studio 2013在多张幻灯片中拆分A * .Pptx文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是处理* .ppt文件但不处理* .pptx文件的示例代码。



Here are the sample codes which is working on *.ppt file but not working on *.pptx file.

OpenFileDialog opObject = new OpenFileDialog();

            opObject.Filter = "Office Documents(*.doc,*.xls,*.pptx)|*.doc;*.xls;*.pptx";

            if (opObject.ShowDialog() == DialogResult.OK)
            {
                string path = opObject.FileName;
                //string pth = Path.GetFileName(path);
                //int num = RetrieveNumberOfSlides(path);
                
                Microsoft.Office.Interop.PowerPoint.Application pptapp = new Microsoft.Office.Interop.PowerPoint.Application();

                Microsoft.Office.Interop.PowerPoint.Presentation ppt1 = pptapp.Presentations.Open(path, Microsoft.Office.Core.MsoTriState.msoFalse,
                Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoFalse);
                string filename = @"D:\PPT";
                
                int num = ppt1.Slides.Count;

                for (int i = 1; i <=num; i++)
                {
                    string s = i.ToString();
                    string fullpath = filename + s +"ppt";
                    ppt1.Slides[i].Export(fullpath,"ppt");              
                }


            }

推荐答案

这篇关于如何在C#的帮助下使用Visual Studio 2013在多张幻灯片中拆分A * .Pptx文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆