gpt4 book ai didi

C# 将 .ppt 转换为图像

转载 作者:太空宇宙 更新时间:2023-11-03 14:19:23 25 4
gpt4 key购买 nike

我正在尝试使用 C# 将 .ppt 文件转换为图像集合。

我正在使用以下代码:

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

.....

Microsoft.Office.Interop.PowerPoint.Application app = new Microsoft.Office.Interop.PowerPoint.Application();

Presentation pres = app.Presentations.Open(@"C:\Users\XYZ\Desktop\Presentation.ppt", MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);

pres.SaveAs(@"C:\Users\XYZ\Desktop\", PpSaveAsFileType.ppSaveAsJPG, MsoTriState.msoFalse);

pres.Close();

我收到以下异常:

Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

在线:

Microsoft.Office.Interop.PowerPoint.Application app = 
new Microsoft.Office.Interop.PowerPoint.Application();

是否需要安装完整版的 Office 2010 才能使此代码正常工作(我只安装了 Powerpoint Viewer),或者是否有其他解决此异常的方法?

最佳答案

您需要安装完整的 PowerPoint 才能实现此目的。查看者无法操作 Powerpoint 文件。

关于C# 将 .ppt 转换为图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5850657/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com