Merge Powerpoint presentations

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SammyB
    Recognized Expert Contributor
    • Mar 2007
    • 807

    #31
    Originally posted by gill1978
    Errrrr yeah confused - how did you know???
    That's why we get paid the big bucks!

    Comment

    • gill1978
      New Member
      • May 2007
      • 19

      #32
      This is as far as I got ... the addition of the extra slide just isn't working ... can you see what i'm missing....???

      Code:
              Powerpoint.ApplicationClass ppApp = new Powerpoint.ApplicationClass();
              ppApp.Visible = Office.MsoTriState.msoTrue;
              Powerpoint.Presentations ppSet = ppApp.Presentations;
              Powerpoint.Presentation ppMergedPres = ppSet.Add(Office.MsoTriState.msoTrue);
              Powerpoint.Slides ppMergedSlides = ppMergedPres.Slides;
              Powerpoint.DocumentWindows ppWindows = ppMergedPres.Windows;
              Powerpoint.DocumentWindow ppWindow = ppWindows[1];
              Powerpoint.View ppMergedView = ppWindow.View;
              Powerpoint.Presentation ppPres = ppSet.Add(Office.MsoTriState.msoTrue);
              Powerpoint.Slides ppSlides = ppPres.Slides;
              Powerpoint.Slide ppSlide = ppSlides.Add(1, Powerpoint.PpSlideLayout.ppLayoutText);
              System.Collections.Generic.List<String> selected = new System.Collections.Generic.List<String>();
              foreach (ListItem o in FileSelectedListBox.Items)
              {
      
                      //ppSlides.InsertFromFile(o, ppSlides.Count, 1, 999);
                  ppPres = ppSet.Open(o.Value.ToString(), Office.MsoTriState.msoTrue, Office.MsoTriState.msoFalse, Office.MsoTriState.msoTrue);
                  ppSlides = ppPres.Slides;
                  for (int i = ppSlides.Count; i >= 1; i--)
                  {
                      ppSlides[i].Copy();
                      ppMergedView.Paste();
                  }
                  ppPres.Close();
              }
      
              //ppSlides = ppPres.Slides;
              ppSlides.Add(1, Powerpoint.PpSlideLayout.ppLayoutText); 
              ppSlide.Shapes[1].TextFrame.TextRange.Text = "Questionnaire";
              ppSlide.Shapes[2].TextFrame.TextRange.Text = relManNameTextBox.Text;
      
              string sFileName = System.IO.Path.ChangeExtension(System.IO.Path.GetRandomFileName(), "ppt");
              ppMergedPres.SaveAs(@"V:\projects\JG\PitchBook\PitchBook\Presentations\Built\" + sFileName, Powerpoint.PpSaveAsFileType.ppSaveAsPresentation, Office.MsoTriState.msoFalse);
              ppMergedPres.Close();
              System.Runtime.InteropServices.Marshal.ReleaseComObject(ppMergedPres);
              ppMergedPres = null;
              System.Runtime.InteropServices.Marshal.ReleaseComObject(ppSlides);
              ppSlides = null;
              ppApp.Quit();
              System.Runtime.InteropServices.Marshal.ReleaseComObject(ppSet);
              ppSet = null;
              System.Runtime.InteropServices.Marshal.ReleaseComObject(ppApp);
              ppApp = null;

      Comment

      • SammyB
        Recognized Expert Contributor
        • Mar 2007
        • 807

        #33
        All of your ppSlides.Add should be ppMergedSlides. Add

        Comment

        • richardsugg
          New Member
          • Sep 2008
          • 1

          #34
          I've posted a solution in javascript here: http://code.google.com/p/powerpointjoin/

          Comment

          • chrizstone
            New Member
            • Nov 2009
            • 3

            #35
            Hi Guys, that Code for Merging Single Slides works perfect for me! But one Problem! My single Slides do have a Template( Background, Font, etc...)...

            When i merge the Slides the merge.ppt dont have this Template! How can i fix this?

            Comment

            • Mark Daniels
              New Member
              • Jul 2010
              • 1

              #36
              How about a solution for Mac users? I have a similar situation where I need to combine multiple slides from different presentations into one presentation. Ideally, I'd like to keep the formatting in tact.

              Looking for a solution on this...thanks.

              Comment

              Working...