C# PPT 내용 읽기
PowerPoint.Application PowerPoint_App = new PowerPoint.Application();
PowerPoint.Presentations multi_presentations = PowerPoint_App.Presentations;
PowerPoint.Presentation presentation = multi_presentations.Open(@"C:\test - 복사본.pptx");
string presentation_text = "";
for (int i = 0; i < presentation.Slides.Count; i++)
{
foreach (var item in presentation.Slides[i + 1].Shapes)
{
var shape = (PowerPoint.Shape)item;
if (shape.HasTextFrame == MsoTriState.msoTrue)
{
if (shape.TextFrame.HasText == MsoTriState.msoTrue)
{
var textRange = shape.TextFrame.TextRange;
var text = textRange.Text;
presentation_text += text + " ";
textBox1.Text = presentation_text;
}
}
}
}
PowerPoint_App.Quit();
Console.WriteLine(presentation_text);
ppt 는 문제가 많다