i would like convert pps(x) or ppt(x) to PDF using C# and Microsoft.Office.Interop.PowerPoint. To do this, I use a method performing the following coding:
Microsoft.Office.Interop.PowerPoint.Presentation presentation = null; Microsoft.Office.Interop.PowerPoint.Application application = null; try { application = new Microsoft.Office.Interop.PowerPoint.Application(); presentation = application.Presentations.Open(sourcePath, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse); presentation.SaveAs(targetPath, PpSaveAsFileType.ppSaveAsPDF, Microsoft.Office.Core.MsoTriState.msoTrue); result = true; } catch (Exception ex) { Console.WriteLine(ex.Message); result = false; } finally { if (presentation != null) { presentation.Close(); presentation = null; } if (application != null) { application.Quit(); application = null; } } return result; When the method is invoked for the first time, the ppsx is saved as pdf successfully. But when the method is invoked for another time, the following exception is raised on application = new Microsoft.Office.Interop.PowerPoint.Application();
The exception message is: Creating an instance of the COM component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} from the IClassFactory failed due to the following error: 800706b5 The interface is unknown. (Exception from HRESULT: 0x800706B5). Right before this exception is raised the console shows another exception "System.Runtime.InteropServices.COMException" in mscorlib.dll.
When navigation into the interface Microsoft.Office.Interop.PowerPoint.Application via F12, the GUID of this interface is 91493442-5A91-11CF-8700-00AA0060263B. So it is slightly different to the GUID inside the exception's message.
I would like to ask you, how to fix this issue?
PS: Microsoft Office 2010 is installed on this Notebook (running on Microsoft Win 7)
Thank you and best regards
Windows 7 32-bitorWindows 7 64-bit.We also need to know ifOffice 2010 64-bitorOffice 2010 32-bitis being used. The error indicates your program cannot even use the reference in question which points to classic problem of a 64-bit process trying to load a 32-bit assembly.