PowerPoint.Application objApp;
PowerPoint.Presentations objPresSet;
PowerPoint._Presentation objPres;
objApp = new PowerPoint.Application();
objPresSet = objApp.Presentations;
objPres = objPresSet.Open("G:\\temp.ppt", Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue);
int SlideCount = objPres.Slides.Count;
int FirstSlideId = objApp.ActiveWindow.Selection.SlideRange.SlideID;
for (int j = FirstSlideId; j < FirstSlideId + SlideCount; j++)
{
objPres.Slides.FindBySlideID(j).Master.Background.Export("C:\\img" + j + ".jpg",
Microsoft.Office.Interop.PowerPoint.PpShapeFormat.ppShapeFormatJPG, 800, 600,
Microsoft.Office.Interop.PowerPoint.PpExportMode.ppScaleToFit); // Exporting Slide Background
objPres.Slides.FindBySlideID(j).Master.Background.Export("C:\\img" + j + ".jpg",
Microsoft.Office.Interop.PowerPoint.PpShapeFormat.ppShapeFormatJPG, 800, 600,
Microsoft.Office.Interop.PowerPoint.PpExportMode.ppScaleToFit); // Exporting Slide Background
}