Click here to Skip to main content
15,887,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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");              
                }


            }
Posted
Updated 31-Jul-14 20:05pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900