Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:

C#
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900