Divide slides into different ppts

0

I'm using the "Powerpoint Add in 1" project in Visual Studio 2013, and I have the following problem, I have a .ppt file with 2 slides, I need to separate these 2 slides into different presentations so I can do 2 different videos, video for slide 1 and the 2nd video for slide 2, but I'm only able to make a single video with the 2 slides.

        string fileName = @"C:\testewiplay.pptx";
        string exportName = "video_of_presentation";
        string exportPath = @"C:\{0}.mp4";


        Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
        ppApp.Visible = MsoTriState.msoTrue;
        ppApp.WindowState = PpWindowState.ppWindowMinimized;
        Microsoft.Office.Interop.PowerPoint.Presentations oPresSet = ppApp.Presentations;
        Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(fileName,
                    MsoTriState.msoFalse, MsoTriState.msoTrue,
                     MsoTriState.msoTrue);

        try
        {

            oPres.Convert2(fileName);
            oPres.CreateVideo(exportName, true, 5, 1080, 25,     100);

            oPres.SaveCopyAs(String.Format(exportPath, exportName),
                PowerPoint.PpSaveAsFileType.ppSaveAsMP4,
                MsoTriState.msoCTrue);

        }
        catch (Exception msg)
        {

           var mensagem = msg.Message;

        }
        finally
        {

            ppApp.Quit();
        }
    
asked by anonymous 12.08.2014 / 19:15

1 answer

0

This was the solution I was able to search for!

string fileName = @"C:\wiplay\pp\testewiplay.pptx";
            string exportName = "video_of_presentation";
            string exportPath = @"C:\wiplay\pp\{0}.mp4";


            Microsoft.Office.Interop.PowerPoint.Application ppApp = new Microsoft.Office.Interop.PowerPoint.Application();
            ppApp.Visible = MsoTriState.msoTrue;
            ppApp.WindowState = PpWindowState.ppWindowMinimized;
            Microsoft.Office.Interop.PowerPoint.Presentations oPresSet = ppApp.Presentations;
            //Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(fileName,
            //            MsoTriState.msoFalse, MsoTriState.msoTrue,
            //             MsoTriState.msoTrue);
            Microsoft.Office.Interop.PowerPoint._Presentation oPres = oPresSet.Open(fileName,
                      MsoTriState.msoFalse, MsoTriState.msoTrue,
                       MsoTriState.msoTrue);
            try
            {
            List<Microsoft.Office.Interop.PowerPoint._Presentation> lista = new List<Microsoft.Office.Interop.PowerPoint._Presentation>();
            for (int i = 0; i <= oPresSet.Count; i++)
            {
                lista.Add(oPres);
            }
            int a = 0;
            int slide_count = oPres.Slides.Count;
            foreach (Microsoft.Office.Interop.PowerPoint.Slide slide in oPres.Slides)
            {

                slide.Delete();
                oPres.CreateVideo(exportName, true, 5, 1080, 25, 100);
                oPres.SaveCopyAs(String.Format(exportPath, exportName + a),
                    PowerPoint.PpSaveAsFileType.ppSaveAsMP4,
                    MsoTriState.msoCTrue);
                a++;
            }
        }
        finally
        {

            ppApp.Quit();
        }
    
13.08.2014 / 15:58