I am a beginner with C# and windows programming. I have written a service which converts a powerpoint file to individual slide images using the slide.export method that the microsoft.office.interop.powerpoint libraries provide. I am able to get all the slides but some of them seem to be broken and i see a "Image cannot be displayed. Memory exceeded" or the likes of it. I thought it was insufficient memory and then just tried it with a ppt having one slide(whose image was broken) and to my dismay I found the single image to be broken as well.
Am I using export wrongly or should I pass different arguments than I am passing already? I will paste the code below.
Microsoft.Office.Interop.PowerPoint.Application appPpt
= new Microsoft.Office.Interop.PowerPoint.Application();
Microsoft.Office.Interop.PowerPoint.Presentation objActivePresentation
= appPpt.Presentations.Open(strFilePath,
Microsoft.Office.Core.MsoTriState.msoCTrue,
Microsoft.Office.Core.MsoTriState.msoTriStateMixed,
Microsoft.Office.Core.MsoTriState.msoFalse);
foreach (Microsoft.Office.Interop.PowerPoint.Slide objSlide
in objActivePresentation.Slides)
{
//Names are generated based on timestamp.
objSlide.Export(slideName, "PNG", 960, 720);
objSlide.Export(slideNameMedium, "JPG", 307, 231);
objSlide.Export(slideNametn, "JPG", 150, 113);
}
I’m in need of help here. Thanks in advance.
try SaveAs.
Hope it helps…..