0

I am trying to paste multiple slides from a different PPTs in an existing PPT. I could paste multiple slides but issue is formating of slides is not preserved. my code is as follows

Presentation Pres = pptApp.Presentations.Open("Original.pptx", MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
int counter = 1;
//slideNumbers is a list of slide numbers or position at which we are going to insert the slide in original file
                foreach (var number in slideNumbers)
                {
                    if (pres != null)
                    {                                                       
                        pres.Slides[number].Delete();
                        pres.Slides.InsertFromFile("temp.pptx", number- 1, counter, counter);                         
                        counter++;                        
                    }
                }
                              }
            if (pres != null)
            {
                pres.SaveAs("Final.pptx");
                pres.Close();
                Marshal.ReleaseComObject(pres);
            }

I found the VBA equivalent of what I'm searching for, but couldn't convert it into C#. (Refer: Programmatically combine slides from multiple presentations into a single presentation)

I need solution in c#. Thank you !

Community
  • 1
  • 1
Purab
  • 72
  • 6
  • Looking at the comment in the the linked code, if the slides to be pasted in don't override the master styles then there's very little code to convert, it looks essentially like a "Paste Special". – stuartd Sep 13 '16 at 10:31
  • @stuartd I'm not able to understand. Can you please provide a code snippet? – Purab Sep 13 '16 at 10:59

0 Answers0