none
Problem with convert ppt to pdf using MIcrosoft.Office.Interop.PowerPoint and ExportAsFixedFormat RRS feed

  • Question

  • Hy

    My problem occur when I trying export ppt file to pdf file using ExportAsFixedFormat.

    My exception: "System.Runtime.InteropServices.COMException 0x80006005": Error HRESULT E_FAIL has been returned a call from a COM component."

    My code in C#

     present.ExportAsFixedFormat(
                        @"C:\aaa\ppt0.pdf",
                        Power.PpFixedFormatType.ppFixedFormatTypePDF,
                        Power.PpFixedFormatIntent.ppFixedFormatIntentPrint,
                        MsoTriState.msoFalse,
                        Power.PpPrintHandoutOrder.ppPrintHandoutVerticalFirst,
                        Power.PpPrintOutputType.ppPrintOutputSlides,//ppPrintOutputBuildSlides, 
                        MsoTriState.msoFalse, null
                        , 
                        Power.PpPrintRangeType.ppPrintAll
                        ,"", false, true, false, false, false);

    In Windows 7 64x and Office 2007 work perfect.

    In Windows 7 32x and Office 2007 occur exception like above.

    Where is problem?

    I can not find eny good solution on Internet :(

    Monday, May 22, 2017 3:40 PM

All replies

  • Hi Thomas Pietrus,

    Thank you for posting here.

    According to your question is more related to office, I will move it to General Office Development forum for suitable support.

    The Visual C# discuss and ask the C# programming language, IDE, libraries, samples and tools.

    If you have some grammar or code errors, please feel free to contact us. We will try our best to give you a solution.

    Thanks for your understanding and cooperation.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, May 23, 2017 3:10 AM
  • I used following code to convert PPT/PPTX to PDF and it works like a charm.

    //create PPT document
    Presentation presentation = new Presentation();
    
    //load PPT file from disk
    presentation.LoadFromFile("template.ppt");
    
    //save the PPT do PDF file format
    presentation.SaveToFile("ToPdf.pdf", FileFormat.PDF);

    reference: Convert PowerPoint to PDF in C#

    Wednesday, May 24, 2017 3:24 AM
  • Hello,

    We are glad that you have resolved the issue and thanks for sharing the solution here.

    I suggest you mark it as answer to close this thread.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 24, 2017 5:01 AM
    Moderator