Split slides into Diferrent ppts

Asked

Viewed 141 times

0

I am using the project "Powerpoint Add in 1" in Visual Studio 2013, and I have the following problem, I have a . ppt with 2 slides, I need to separate these 2 slides into different presentations so I can make 2 different videos, 1st video referring to slide 1 and 2nd video referring to 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();
        }

1 answer

0


that was the solution I was able to research!

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();
        }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.