0

I have a client in need of an application that uploads a powerpoint file to a web app that can display the slides as jpegs (or flash, silverlight, HTML, video.. any format really) using ASP.NET.

I built the application with MVC in VS 2010 using Office developer tools but the clients server does not have Powerpoint and it seems the Microsoft.Office.Interop.Powerpoint assembly won't function if it can't call Powerpoint on the host machine.

I've looked at every possible discussion dealing with this, the majority conclude its bad practice to even have Powerpoint deployed on a server, so my question is does anyone know of a utility that can convert PPT slide to JPG or Flash or anything to present the slides on a website?

4

2 回答 2

1

这是使用互操作对象..

    private void mConvertPPT_To_Images(string sPPTFilePath, string sImagesDirectoryPath)
    {
        try
        {
            Microsoft.Office.Interop.PowerPoint.Application appPpt = new Microsoft.Office.Interop.PowerPoint.Application();
            Microsoft.Office.Interop.PowerPoint.Presentation objActivePresentation
                = appPpt.Presentations.Open(sPPTFilePath,
                                            Microsoft.Office.Core.MsoTriState.msoCTrue,
                                            Microsoft.Office.Core.MsoTriState.msoTriStateMixed,
                                            Microsoft.Office.Core.MsoTriState.msoFalse);
            //objActivePresentation.SaveAs(sImagesDirectoryPath, PpSaveAsFileType.ppSaveAsJPG, MsoTriState.msoFalse);
            //objActivePresentation.Export(sImagesDirectoryPath + @"\Slide1.png", "png", 960, 720);
            //objActivePresentation.SaveAs(sImagesDirectoryPath + "slide", PpSaveAsFileType.ppSaveAsTIF, MsoTriState.msoFalse);
            int i = 0;
            foreach (Microsoft.Office.Interop.PowerPoint.Slide objSlide in objActivePresentation.Slides)
            {
                //Names are generated based on timestamp. 
                //objSlide.Export("Slide" + i, "PNG", 960, 720);
                objSlide.Export(sImagesDirectoryPath + @"\Slide" + i + ".GIF", "GIF", 960, 720);
                i++;
            }
            objActivePresentation.Close();
            appPpt.Quit();
        }
        catch (Exception ex)
        {
            throw;
        }
    }
于 2013-03-06T07:59:12.307 回答
0

iSpring 有一个名为 iSpring Platform ( http://www.ispringsolutions.com/ispring-platform ) 的解决方案。这是一个 SDK,它允许使用 .NET 的软件将 PPT 演示文稿转换为 HTML5 和 Flash。它支持所有效果、动画和其他 PowerPoint 内容。

PS 看了帖子资料,发现作者大概找到了解决办法。也许我的回答对其他人有用。

于 2017-07-31T06:37:31.953 回答