GemBox.Presentation is a .NET component that enables you to read, write, edit, convert, and print presentation files from your .NET applications using one simple API.

Read PowerPoint Files in C# and VB.NET

GemBox.Presentation supports reading PowerPoint presentations in C# and VB.NET from a file path or a stream. This functionality is exposed through the PresentationDocument.Load static method overloads.

The following example demonstrates how to read a PowerPoint presentation from a file path, iterate over all Shape, TextParagraph and TextRun elements, and output text for all TextRun elements with font-weight information to the Console output.

Screenshot
Reading Screenshot

See the full code below, use Run Example to execute.

Upload your file(Drag files here)

Download a sample file

using System;
using System.IO;
using System.Linq;
using System.Text;
using GemBox.Presentation;
using GemBox.Presentation.Tables;

class Sample
{
    [STAThread]
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        PresentationDocument presentation = PresentationDocument.Load("Reading.pptx");

        StringBuilder sb = new StringBuilder();

        Slide slide = presentation.Slides[0];

        foreach (Shape shape in slide.Content.Drawings.OfType<Shape>())
        {
            sb.AppendFormat("Shape ShapeType={0}:", shape.ShapeType);
            sb.AppendLine();

            foreach (TextParagraph paragraph in shape.Text.Paragraphs)
            {
                foreach (TextRun run in paragraph.Elements.OfType<TextRun>())
                {
                    bool isBold = run.Format.Bold;
                    string text = run.Text;

                    sb.AppendFormat("{0}{1}{2}", isBold ? "<b>" : "", text, isBold ? "</b>" : "");
                }

                sb.AppendLine();
            }

            sb.AppendLine("----------");
        }

        Console.WriteLine(sb.ToString());
    }
}
Imports System.IO
Imports System.Text
Imports GemBox.Presentation
Imports GemBox.Presentation.Tables

Module Samples

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim presentation As PresentationDocument = PresentationDocument.Load("Reading.pptx")

        Dim sb As New StringBuilder()

        Dim slide As Slide = presentation.Slides(0)

        For Each shape As Shape In slide.Content.Drawings.OfType(Of Shape)
            sb.AppendFormat("Shape ShapeType={0}:", shape.ShapeType)
            sb.AppendLine()

            For Each paragraph As TextParagraph In shape.Text.Paragraphs
                For Each run As TextRun In paragraph.Elements.OfType(Of TextRun)
                    Dim isBold As Boolean = run.Format.Bold
                    Dim text As String = run.Text

                    sb.AppendFormat("{0}{1}{2}", If(isBold, "<b>", ""), text, If(isBold, "</b>", ""))
                Next

                sb.AppendLine()
            Next

            sb.AppendLine("----------")
        Next

        Console.WriteLine(sb.ToString())

    End Sub

End Module

Check next sample.