How to Convert PowerPoint to Word in C#

This short tutorial contains all the required information to convert PowerPoint to Word in C#. You will learn how to load an existing PowerPoint presentation like PPTX and then save it as a Word document say a DOCX file. You will also learn how to use multiple libraries to achieve this requirement for changing PowerPoint into Word in C#.

Steps to Transform PowerPoint to Word in C#

  1. Configure the development environment to add Aspose.Slides for .NET and Aspose.Words for .NET from the repository
  2. Load the source presentation into the Presentation class object
  3. Create a memory stream object
  4. Save the loaded presentation as an HTML file into the memory stream
  5. Create LoadOptions class object to control the loading of the HTML stream by setting load format as HTML
  6. Load the HTML data saved in the memory stream into the Document class object from Aspose.Words
  7. Save the resultant document as DOCX

These steps describe how to export PowerPoint to Word in C# by using two libraries i.e. Aspose.Slides and Aspose.Words simultaneously. First, we use the Presentation class to load the template PowerPoint presentation and then save it as an HTML file in the memory stream along with the options to customize this loading process. In the final step, we load this memory stream in the Document class object and then save it into a DOCX file.

Code to Convert PPTX to DOCX in C#

This code demonstrates the process for converting PPTX to DOCX in C# by using the Presentation class object by providing the source file name only however, you may use the LoadOptions object from the Aspose.Slides library to set different properties like setting password if the presentation is password protected, setting callback function in case of errors or warnings, etc. It also uses LoadOptions from the Aspose.Words library to set different properties of the input HTML like its format, encoding details, font settings progress, and warning callbacks to name a few.

In this tutorial, we have learned to convert PowerPoint into a Word document in C# by loading an existing presentation and then saving it as a Word document. If you want to learn the process to create a new presentation instead of loading an existing one, refer to the article on how to create PowerPoint presentation using C#.

 English