For an application that I am working, I need to insert slides from one pptx into another.
I tried doing this using the following code
mi_App = new Microsoft.Office.Interop.PowerPoint.Application();
mi_Pres = mi_App.Presentations.Open2007("File1.pptx", MsoTriState.msoTrue,MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);
mi_Pres.Slides.InsertFromFile("File2.pptx", 2, 1, 2);
mi_Pres.SaveAs("File3.pptx", PpSaveAsFileType.ppSaveAsDefault, MsoTriState.msoFalse);
This does insert the corresponding slides from File2.pptx. But the problem is that their background is lost. The slides take up the default background of File1.pptx.
The slides in File2.pptx have the backgrounds defined for each slide. But the ones inserted into the new pptx have a uniform background that is same as the default background of File1.pptx.
I tried copying background by assigning to mi_Pres.Slides.Background
But that did not work, because Background is a readonly!
Can you please tell me what is the correct way of doing this? How do I insert slides from another file, along with the corresponding background?