Search code examples
c#.netvisual-studio-2010com32bit-64bit

Need MS Office installed to convert PPT to another format?


I'm exporting a PPT file into JPGs using the following code. It does a great job locally, but I'm not sure if it's because I have PowerPoint installed.

When I deploy to the server, I get all types of COM errors. I continue looking for solutions, but I'm thinking that it won't work because the server doesn't have PowerPoint installed.

So, will the following code only work if I have MS PowerPoint installed? Thanks.

    Microsoft.Office.Interop.PowerPoint.Application appPpt = new Microsoft.Office.Interop.PowerPoint.Application();
    Microsoft.Office.Interop.PowerPoint.Presentation objActivePresentation
        = appPpt.Presentations.Open(SourceFilePath,
                                    Microsoft.Office.Core.MsoTriState.msoCTrue,
                                    Microsoft.Office.Core.MsoTriState.msoTriStateMixed,
                                    Microsoft.Office.Core.MsoTriState.msoFalse);
    int i = 0;
    foreach (Microsoft.Office.Interop.PowerPoint.Slide objSlide in objActivePresentation.Slides)
    {
        objSlide.Export(DestinationFilePath + i + ".JPG", "JPG", 1024, 768);
        i++;
    }
    objActivePresentation.Close();
    appPpt.Quit();

Solution

  • Yes, you will need Microsoft Office installed on the machine running the code in order to use the Interop assemblies.

    Some 3rd party libraries, such as Aspose.Slides do not require Office to be installed on the machine.