PNG JPG BMP TIFF PPTX
Aspose.Slides  for .NET

Parse PPTX Formats in C#

Native and high performance PPTX document parsing using server-side Aspose.Slides for .NET APIs, without the use of any software like Microsoft or Adobe PDF.

Parse PPTX File Using C#

In order to parse PPTX file, we’ll use

Aspose.Slides for .NET

API which is a feature-rich, powerful and easy to use document manipulation API for C# platform. Open

NuGet

package manager, search for Aspose.Slides and install. You may also use the following command from the Package Manager Console.

Command


PM> Install-Package Aspose.Slides.NET

How to Parse PPTX Files in C#

A basic document parsing with Aspose.Slides for .NET APIs can be done with just few lines of code.

  1. Load PPTX file.

  2. Get all text frames.

  3. Loop through each paragraph portion.

  4. Get the required output like text, font etc.

System Requirements

Our APIs are supported on all major platforms and Operating Systems. Before executing the code below, please make sure that you have the following prerequisites on your system.

  • Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms
  • Development environment like Microsoft Visual Studio
  • Aspose.Slides for .NET DLL referenced in your project - Install from NuGet using the Download button above
 

Parse PPTX Files - C#

//Extract Text from the Whole pptx Presentation 
    Presentation pptxPresentation = new Presentation(dataDir + "demo.pptx");
    
    //Get an Array of ITextFrame objects from all slides in the PPTX
    ITextFrame[] textFramesPPTX = Aspose.Slides.Util.SlideUtil.GetAllTextFrames(pptxPresentation, true);
    
    //Loop through the Array of TextFrames
     for (int i = 0; i < textFramesPPTX.Length; i++)
    
        //Loop through paragraphs in current ITextFrame
        foreach (IParagraph para in textFramesPPTX[i].Paragraphs)
    
             //Loop through portions in the current IParagraph
             foreach (IPortion port in para.Portions)
             {
                //Display text in the current portion
                Console.WriteLine(port.Text);
    
                //Display font height of the text
                Console.WriteLine(port.PortionFormat.FontHeight);
    
                //Display font name of the text
                if (port.PortionFormat.LatinFont != null)
                   Console.WriteLine(port.PortionFormat.LatinFont.FontName);
            }  

    
 
  • About Aspose.Slides for .NET API

    Aspose.Slides API can be used to read, write, manipulate and convert Microsoft PowerPoint documents to PDF, XPS, HTML, TIFF, ODP and various other formats. One can create new files from scratch and save those in the relevant supported formats. Aspose.Slides is a standalone API for creating, parsing or manipulating presentations, slides and elements and it does not depend on any software like Microsoft or OpenOffice.

    Online PPTX Parser Live Demos

    Other Supported Parsing Formats

    Using C#, one can easily parse other formats including.

    ODP (OpenDocument Presentation Format)
    PPT (Microsoft PowerPoint 97-2003)