Parse ODP Files using C#
Extract text and inspect text formatting in ODP files with server-side .NET APIs.
Parse ODP File Using C#
Use Aspose.Slides for .NET to extract text from ODP presentations. Install the package from NuGet or run the following command in the Package Manager Console.
Command
PM> Install-Package Aspose.Slides.NETParse ODP Files - C#
using var presentation = new Presentation("presentation.odp");
var textFrames = SlideUtil.GetAllTextFrames(presentation, true);
foreach (var textFrame in textFrames)
{
foreach (var paragraph in textFrame.Paragraphs)
{
foreach (var portion in paragraph.Portions)
{
Console.WriteLine(portion.Text);
Console.WriteLine(portion.PortionFormat.FontHeight);
var latinFont = portion.PortionFormat.LatinFont;
if (latinFont is not null)
{
Console.WriteLine(latinFont.FontName);
}
}
}
}How to Parse ODP Files in C#
Basic document parsing with the Aspose.Slides for .NET API requires just a few lines of code.
- Load the ODP file with
Presentation. - Retrieve text frames with
SlideUtil.GetAllTextFrames. - Iterate through text frames, paragraphs, and portions.
- Read
Text,FontHeight, andLatinFont.FontNameproperties as needed.
System Requirements
A supported .NET runtime and an Aspose.Slides for .NET package reference are required. You can use Visual Studio or another compatible C# development environment.
- .NET Framework, .NET, Mono, or Xamarin-compatible environment
- A C# development environment such as Visual Studio
- Aspose.Slides for .NET installed from NuGet
Built with Aspose.Slides
Extract Text and Images Online
The free Aspose.Slides Parser app is built with Aspose.Slides for .NET, the same API as the code above. Open it and see what the API can do with your own ODP files.
- Runs in your browser, nothing to install.
- See how Aspose.Slides reads your files before you write code.
- Upload your ODP file and get its text and images.
- Download everything as one ZIP archive.
What is ODP File Format?
ODP files use the OpenDocument Presentation format. A presentation contains slides with text, images, formatting, animations, and other media. Applications that support the OpenDocument format, such as OpenOffice and StarOffice, can open ODP files.
Other Supported Parsing Formats
Using C#, you can also parse the following formats.