How to Convert HTML to PowerPoint using C#

This article guides on how to convert HTML to PowerPoint using C#. It contains all the information required to set the environment, steps to write the program, and a runnable sample code to insert HTML file into PowerPoint using C#. It provides links to all the important classes and methods required to write the application and then save the resultant file as PPT or PPTX as per the requirements.

Steps to Add HTML to PowerPoint using C#

  1. Set the IDE to use Aspose.Slides for .NET to insert HTML
  2. Create a new presentation using the Presentation class for embedding HTML
  3. Load the source HTML file into the stream
  4. Append the contents from the HTML at the end of the loaded presentation using the AddFromHtml() method
  5. Save the resultant PowerPoint Presentation on the disk

These steps provide details to insert HTML in PowerPoint using C#. The process is quite simple as a new presentation file is created or you may load an existing presentation file using the Presentation class object. This class contains a collection named Slides that provides a method AddFromHtml() to append the slides at the end of the presentation.

Code to Insert HTML to PowerPoint using C#

This code demonstrates the process of embedding HTML in PowerPoint using C#. It is performed using the Presentation.SlidesCollection.AddFromHtml() method that has a number of overloaded functions taking different arguments like string, stream, IExternalResourceResolver, and TextReader. You can set the callback object to fetch external objects in the HTML string however you may set it to null to ignore external resources.

This article has taught us to convert HTML to PowerPoint using C#. If you want to learn the process to convert PDF to presentation, refer to the article on how to convert PDF to presentation using C#.

 English