You may often need to extract text from the PowerPoint slides in order to perform text analysis. On the other hand, you may want to extract and save the text in a file or database for further processing. In accordance with that, this article covers how to extract text from PowerPoint presentations using C#. Particularly, you will learn how to extract text from a specific slide or whole presentation.
- API to Extract Text from PowerPoint PPTX
- Extract Text from a PowerPoint Slide
- Extract Text from a PowerPoint Presentation
- Get a Free API License
C# API to Extract Text from PowerPoint PPTX
In order to manipulate PowerPoint presentations, Aspose offers Aspose.Slides for .NET. The said API is designed to implement PowerPoint automation features in .NET applications. It also provides some simple ways of extracting text from the PPTX presentations. You can either download the API or get it installed using NuGet.
PM> Install-Package Aspose.Slides.NET
Extract Text from a PowerPoint Slide in C#
The following are the steps to extract text from a slide in a PowerPoint presentation.
- Load the presentation using Presentation class.
- Get all the text frames from a slide into ITextFrame array using SlideUtil.GetAllTextBoxes() method.
- Loop through each ITextFrame and access its text using ITextFrame.Paragraphs property.
- Retrieve and print text from each Portion of the paragraph.
The following code sample shows how to extract text from a PowerPoint slide using C#.
Extract Text from PowerPoint Presentation in C#
You can also extract text from the whole PowerPoint presentation using Aspose.Slides for .NET. The following are the steps to perform this operation.
- Load the presentation using Presentation class.
- Get all the text frames in presentation using SlideUtil.GetAllTextFrames() method.
- Loop through each ITextFrame and access its Paragraphs.
- Access the portions of the paragraphs and print their text.
The following code sample shows how to extract text from a PowerPoint presentation.
Get a Free API License
In case you want to try the API without evaluation limitations, you can get a free temporary license.
Conclusion
In this article, you have learned how to extract text from PowerPoint presentations. Particularly, you have seen how to extract text from a specific slide or the whole presentation using C#. You can explore more about Aspose.Slides for .NET using documentation. In case you would have any queries or confusion, inform us via our forum.