문제

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

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top