I have a code which converts the PowerPoint presentation to HTML using Office 2007. The code which runs on Office 2007 without a problem is as below:
static void Main(string[] args)
{
string source = "C:\\Temp\\testPPTX.pptx";
string tempFile = "C:\\Temp\\mytest.html";
Application app = new Application();
Presentation presentation = app.Presentations.Open(source, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoFalse);
// Save the presentation as HTML
presentation.SaveAs(tempFile, PpSaveAsFileType.ppSaveAsHTML, MsoTriState.msoTriStateMixed);
// Close the presentation and quit PowerPoint
presentation.Close();
app.Quit();
Console.WriteLine("Conversion completed.");
}
When I run the above code in the higher Office version such as Office 2019 or Office 365, I receive an error:
System.Runtime.InteropServices.COMException: 'Presentation (unknown member) : Invalid request. Saving as an HTML presentation is not supported in this version of PowerPoint.'
Is there a way to convert the PowerPoint presentation HTML using the above code?