I am starting to program in C # and Windows. I wrote a service that converts a powerpoint file into separate slide images using the method slide.exportthat libraries provide microsoft.office.interop.powerpoint. I can get all the slides, but some of them seem to be broken, and I see "Image cannot be displayed. Memory exceeded"or the like. I thought it was insufficient memory, and then just tried it with ppt with one slide (whose image was broken), and to my horror, I found that one image was also broken.
Am I using the export incorrectly or should pass different arguments, what am I already driving through? I will insert 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)
{
objSlide.Export(slideName, "PNG", 960, 720);
objSlide.Export(slideNameMedium, "JPG", 307, 231);
objSlide.Export(slideNametn, "JPG", 150, 113);
}
I need help here. Thanks in advance.
source
share