使用c#Interop读取Powerpoint文件中的图像
我需要使用c#Interop库解析powerpoint文件。使用c#Interop读取Powerpoint文件中的图像,c#,office-interop,powerpoint-interop,C#,Office Interop,Powerpoint Interop,我需要使用c#Interop库解析powerpoint文件。 我知道如何获取文本值,但我不知道如何获取图片数据 例如,powerpoint幻灯片由文本和图片组成,如下所示。 有了这段代码,我可以识别标题文本,但是如何获取图像数据呢 private static void parse(string pptPath) { Application app = new Application(); string presentation = pptPath; Pres
我知道如何获取文本值,但我不知道如何获取图片数据 例如,powerpoint幻灯片由文本和图片组成,如下所示。 有了这段代码,我可以识别标题文本,但是如何获取图像数据呢
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());
}
}
}
}
}
我认为使用互操作无法读取PowerPoint中的图像。我认为使用互操作无法读取PowerPoint中的图像