使用Microsoft.Office.Interop.PowerPoint时,使用CLSID检索组件的COM类工厂

时间:2017-10-30 11:09:21

标签: c# powerpoint

我目前正在尝试将幻灯片转换为图片。当我尝试构建应用程序时出现此错误:

  

使用时检索具有CLSID的组件的COM类工厂   Microsoft.Office.Interop.PowerPoint

我曾尝试使用IIS“Enable-32位应用程序”,但它无效。以下是我的代码:

using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;

public partial class Admin_powerpoint : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Application pptApplication = new Application();
        pptApplication.Visible = MsoTriState.msoTrue;
        Presentation ppt = pptApplication.Presentations.Open(@"files/testing2.pptx", MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);

        var count = 0;
        foreach (Slide slide in ppt.Slides)
        {
            slide.Export(@"asset/images/powerpoint" + count + ".png", "png", 320, 240);
            count++;
        }
    }
}

0 个答案:

没有答案