Convert PowerPoint to HTML

Hello friends,

This post is explain about how to convert ppt file in html pages by application. A requirement comes like when user will provide ppt with attached set of images and application needs to convert it in html pages where images needs to find from ppt and save in one folder and attached with html pages, so html page desing looks like same as ppt.

To implement this I have used MS office atomization tool (DCOM). I have added below dll from .net references.

In MS Power Point has inbuild functionality available to : File> Save as Web Pages. So I have used the same functionality by .net code from Powerpoint compenent.

Below are the code I have implemented to achieve this.

string strSourceFile = @"D:\PPT_Presentation.pptx";
            //Give the name and path of the HTML file to be generated
            string strDestinationFile = @"D:\HTML_Presentation.htm";
            //Create a PowerPoint Application Object

            Microsoft.Office.Interop.PowerPoint.Application oApplication = new Microsoft.Office.Interop.PowerPoint.Application();

            //Create a PowerPoint Presentation object

            Microsoft.Office.Interop.PowerPoint.Presentation oPresentation = oApplication.Presentations.Open(strSourceFile);
            //Call the SaveAs method of Presentaion object and specify the format as HTML
            oPresentation.SaveAs(strDestinationFile, Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsHTML);

            //Close the Presentation object
            //Close the Application object

So once you will run the application there will be one html file created which you provided as destination file and one folder created with same name at same location with all required supported files.

Requirement to run this code:
Microsoft office should be installed on the system
Microsoft office Power Point DCOM configured with application user with proper access.

Note: Use direct component is not suggested by Microsoft, due to performance and reliability issue.
So to achieve this scenario Microsoft suggests Office open xml format.

Please contact me at for more any other information.

Amit Patel
“Enjoy Programming”

About amitpatelit
Having more than 9 years of experience in IT industry. - Strong knowledge and experience on various technologies and tools like ASP.NET, MVC, Entity framework, Razor,VB.NET, C#, WCF,WPF, MVC, Silver light, ASP, XML ,Java Script, HTML, CSS, AJAX, COM/DCOM,MS SQL Server, Enterprise Library, MSMQ, SQL Server Reporting Service, Crystal Reports. - Achieved 7800 points (Star level) in the official Microsoft ASP.NET forum. - MCPD and MCTS in Web, Window and distributed application.

6 Responses to Convert PowerPoint to HTML

  1. Neel Kamal says:

    You can write this in single line as given bellow.

    new Microsoft.Office.Interop.PowerPoint.Application().oApplication.Presentations.Open(strSourceFile).oPresentation.SaveAs(strDestinationFile, Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsHTML);

  2. Neel kamal says:

    Write this simple code for this

    POWERPOINT.Application App = new Microsoft.Office.Interop.PowerPoint.Application();

    POWERPOINT.Presentation pres = App.Presentations.Open(fileName, OFFICECORE.MsoTriState.msoTrue, OFFICECORE.MsoTriState.msoFalse, OFFICECORE.MsoTriState.msoFalse);
    int pageNo = 0;

    pres.SaveAs(imagePath + “\Images”, POWERPOINT.PpSaveAsFileType.ppSaveAsPNG, OFFICECORE.MsoTriState.msoFalse);

    //you need to add references and namespaces as

    using POWERPOINT = Microsoft.Office.Interop.PowerPoint;
    using OFFICECORE = Microsoft.Office.Core;

  3. Adarsh says:

    is there any code in php to convert ppt to html

  4. You can convert PPT or PPTX to Image using Aspose.Slide for .NET API. Try it i hope you will find it useful also.

  5. Penny D'Costa says:

    You can convert PPT or PPTX to image format using C#/.NET Library for Powerpoint like Aspose.slide for .NET. I am using it and very much satisfied with the results it has produced. Try it:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 244 other followers

%d bloggers like this: