2012-02-02 57 views
0

我在我的系统已经打开PPT文件,只是我从C#(WPF) 抛出异常打开新的PPT文档,下面是从日志文件中的有关内容:如何打开新的PPT文档

Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 80080005

使用给定的代码:

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

Windows 7专业版,64位 Office 2007中,所有组件安装。

我该如何处理?

我需要任何建议。

+1

我建议使用类似NPOI,而不是办公室COM自动化。 – munissor 2012-02-02 12:37:51

+1

使用Microsoft.Office.Interop.PowerPoint 12.0对象的DLL。 – 2012-02-02 12:40:31

+0

您是否安装了Office PIA? – 2012-02-02 14:06:42

回答

0

试试这个,但它更改为Microsoft.Office.Interop.PowerPoint:

string[] SplitHTML = fileName.Split('.'); 
string NameNoExt = SplitHTML[0]; 
string FileAsHtml = NameNoExt + ".html"; 

//Word with the document 
Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application(); 
Microsoft.Office.Interop.Word.Document _doc = wordApp.Documents.Open(uri); 
_doc.SaveAs2(FileAsHtml, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatHTML); 
_doc.Close(false); 
wordApp.Quit(); 
System.Runtime.InteropServices.Marshal.ReleaseComObject(_doc); 
browser.Navigate(FileAsHtml);