Reputation: 501
I need to parse a powerpoint file using c# Interop library.
I know how to get text value but I don't know how to get picture data.
For example, the powerpoint slide is composed by a text and a picture, like below.
With this code I'm able to identify the Title text but how to get the image data?
private static void parse(string pptPath)
{
Application app = new Application();
string presentation = pptPath;
Presentation p = app.Presentations.Open(presentation, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
foreach (Slide slide in p.Slides)
{
foreach (Microsoft.Office.Interop.PowerPoint.Shape shape in slide.Shapes)
{
if (shape.HasTextFrame == Microsoft.Office.Core.MsoTriState.msoTrue)
{
var textFrame = shape.TextFrame;
if (textFrame.HasText == Microsoft.Office.Core.MsoTriState.msoTrue)
{
var textRange = textFrame.TextRange;
Console.WriteLine(textRange.Text.ToString());
}
}
}
}
}
Upvotes: 1
Views: 472
Reputation: 91
I think there is no ways to read the image in PowerPoint using interop.
Upvotes: 0