Reputation: 995
I have a PPT slide deck with multiple images. I am iterating through each slide and each shape. I would like to save each shape of type msoPicture as an Image:
foreach (PPT.Slide slide in pptDoc.Slides)
{
foreach (PPT.Shape shape in slide.Shapes)
{
if (shape.Type == Microsoft.Office.Core.MsoShapeType.msoPicture)
{
Image img;
//???? Save shape as image
img.Save(filename);
}
}
}
Upvotes: 0
Views: 2170
Reputation: 1356
You can use the Shape.Export()
method to create an image from an individual shape.
For example like this:
foreach (PPT.Slide slide in pptDoc.Slides)
{
foreach (PPT.Shape shape in slide.Shapes)
{
if (shape.Type == Microsoft.Office.Core.MsoShapeType.msoPicture)
{
shape.Export(filename, Microsoft.Office.Interop.PowerPoint.PpShapeFormat.ppShapeFormatPNG);
}
}
}
Upvotes: 1