Originally posted by gill1978
Merge Powerpoint presentations
Collapse
X
-
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
-
-
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
-
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
Comment