Question

I am having trouble with PowerPoint conversion to HTML.

Here is code

Microsoft.Office.Interop.PowerPoint.Application oApplication = new Microsoft.Office.Interop.PowerPoint.Application();
Microsoft.Office.Interop.PowerPoint.Presentation oPresentation = oApplication.Presentations.Open(sourceFileName);
oPresentation.SaveAs(destFileName, Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsHTML);
oPresentation.Close();
oApplication.Quit();

I get the following error

System.Runtime.InteropServices.COMException (0x80048240): Presentations (unknown member) : Invalid request. The PowerPoint Frame window does not exist. at Microsoft.Office.Interop.PowerPoint.Presentations.Open(String FileName, MsoTriState ReadOnly, MsoTriState Untitled, MsoTriState WithWindow) at SmartBoard_V2.Section.Admin.Areas.DersEditor.DersEdit.convertPowerPoint(String fennKod) in c:\Users\Kamandar\Documents\Visual Studio 2012\Projects\SmartBoard_V2\SmartBoard_V2\Section\Admin\Areas\DersEditor\DersEdit.aspx.cs:line 163

Était-ce utile?

La solution

Note that if you're automating PPT 2013 (or presumably later), this won't work. As of 2013, PowerPoint no longer has a SaveAsHTML method.

Autres conseils

I suspect that you need to set the application to visible before you try and save it.

To do this simply add the following code before declaring the oPresentation object.

oApplication .Visible = Office.MsoTriState.msoTrue;

Edit: Just noticed you are using ASP.NET, Although it is not recommended, you can check here for a similar problem.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top