Error HRESULT E_FAIL has been returned from a call to a COM component

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ohmygod
    New Member
    • Dec 2010
    • 4

    Error HRESULT E_FAIL has been returned from a call to a COM component

    Hi,

    I am using Powerpoint 2007 api to convert ppt files to html files by C# written code. Currently I am meeting with a problem, which is converting from ppt to html is fine but following error reports when converting from html back to ppt.
    Error HRESULT E_FAIL has been returned from a call to a COM component.

    I debugged in the code and found the error occurrs when invoking the open() method of PowerPoint_Clas s.Application's Presentations which works fine when opening ppt file to convert from ppt to html.

    I've also done some manual tesing based on the html files converted from the PPT file. When I tried to open it with PowerPoint 2007, it reports an error "Problems During Load" saying missing data in one html file under the XXXX_files folder but I looked for the html file and it exists there!

    Please allow me to attach this special ppt file (the code works fine with other PPT files whatever converting from ppt to html or from html to ppt).

    Anyone who can give me some suggestions on this would be much appreciated.

    Thanks
    Attached Files
  • ohmygod
    New Member
    • Dec 2010
    • 4

    #2
    Attached is the screenshot when I try to open the test.html with PowerPoint 2007. I do not know if this is the root cause. Please advise.

    BTW, when I click "OK", the ppt is continuing opening with all content displayed fine.
    Attached Files

    Comment

    • ohmygod
      New Member
      • Dec 2010
      • 4

      #3
      It seems that no one likes to answer questions in this forum?

      Comment

      • aliveless
        New Member
        • Nov 2012
        • 1

        #4
        end of 2012 now; still no answer
        having the exact same issue as OP...
        Word works, Excel works, PowerPoint does not...

        VS2010 and Office 2010 with 12.0(2007) PIA

        Have been searching all over the place and this was one of the very few posts concerning this exact problem.

        No answer, anywhere...

        Code:
        using PowerPoint = Microsoft.Office.Interop.PowerPoint;
        
        PowerPoint.Application PowerPointApp = new PowerPoint.Application();
        
        PowerPoint.Presentation presentation = null;
        object paramMissing = Type.Missing;
        
        try
                    {
                        presentation = PowerPointApp.Presentations.Open(filepath, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse);
        
                        if (presentation != null)
                            presentation.SaveAs(targetFilepath, PowerPoint.PpSaveAsFileType.ppSaveAsXPS, Microsoft.Office.Core.MsoTriState.msoTrue);
                            //presentation.ExportAsFixedFormat(targetFilepath, PowerPoint.PpFixedFormatType.ppFixedFormatTypeXPS, PowerPoint.PpFixedFormatIntent.ppFixedFormatIntentPrint);
                    }
        catch (Exception ex)
                    {
                        //COM exception here: HRESULT = E_FAIL
                    }

        Comment

        Working...