Click here to Skip to main content
14,270,795 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hello,
My program should convert a ppt slide into an image file and it does. The only thing that bothers me is the blank PowerPoint window that opens and closes again (with sound). Is it possible to perform this conversion without opening this window?

What I have tried:

if (Path.GetExtension(file).Contains("ppt"))
                    {
                        PPT.Application pptApp = new PPT.Application();
                        pptApp.Visible = MsoTriState.msoTrue;
                        PPT.Presentation pptPr = pptApp.Presentations.Open(file, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
                        pptPr.Slides[1].Export(ImagePath + Path.GetFileNameWithoutExtension(file) + ".png", "png");
                        pptPr.Close();
                        pptApp.Quit();
                        Marshal.ReleaseComObject(pptPr);
                        Marshal.ReleaseComObject(pptApp);
                    }
Posted
Comments
wilford.ramsey 28-Jun-17 7:51am
   
You can use this C# or VB.NET library for PowerPoint to accomplish that with the following code:

var presentation = PresentationDocument.Load("Sample.ppt", new PptLoadOptions());
presentation.Save("Sample.png", new ImageSaveOptions(ImageSaveFormat.Png));

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100