Effortlessly Convert PowerPoint to Word in C# and .NET

Do you need to repurpose content from your PowerPoint presentations (PPT or PPTX)? Converting them to Word documents (DOC or DOCX) can streamline your workflow and enhance content utilization.

  • Microsoft Word offers advanced tools and functionalities for document editing.
  • It also provides robust features for collaboration, printing, and sharing.

Leverage Aspose.Slides and Aspose.Words

To successfully convert PowerPoint files (PPTX or PPT) to Word (DOCX or DOC), install Aspose.Slides for .NET and Aspose.Words for .NET.

Aspose.Slides for .NET extracts text content efficiently from presentations, while Aspose.Words for .NET handles document creation, modification, conversion, rendering, and more, without relying on Microsoft Word.

Quick Start: Convert PowerPoint to Word

  1. Import these namespaces in your program.cs file:
using Aspose.Slides;
using Aspose.Words;
using System.IO;
  1. Implement this code snippet to perform the conversion:
using var presentation = new Presentation("sample.pptx");

var doc = new Document();
var builder = new DocumentBuilder(doc);

foreach (var slide in presentation.Slides)
{
    // Generate a slide image and save it to a memory stream
    using var image = slide.GetImage(1, 1);
    using var imageStream = new MemoryStream();
    image.Save(imageStream, ImageFormat.Png);

    imageStream.Seek(0, SeekOrigin.Begin);
    builder.InsertImage(imageStream.ToArray());

    // Insert slide text into the document
    foreach (var shape in slide.Shapes)
    {
        if (shape is AutoShape autoShape)
        {
            builder.Writeln(autoShape.TextFrame.Text);
        }
    }

    builder.InsertBreak(BreakType.PageBreak);
}

doc.Save("output.docx");