C# 将 .ppt 转换为图像
我正在尝试使用 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();
我收到以下异常:
由于以下错误,检索 CLSID 为 {91493441-5A91-11CF-8700-00AA0060263B} 的组件的 COM 类工厂失败:80040154 类未注册(HRESULT 异常:0x80040154 (REGDB_E_CLASSNOTREG))。
在线:
Microsoft.Office.Interop.PowerPoint.Application app =
new Microsoft.Office.Interop.PowerPoint.Application();
是否需要安装完整版本的 Office 2010 才能使此代码正常工作(我只安装了 Powerpoint Viewer),或者是否有其他解决方案来解决此异常?
I am trying to convert a .ppt file to a collection of images using C#.
I am using the following code :
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();
I am getting the following exception :
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)).
at the line :
Microsoft.Office.Interop.PowerPoint.Application app =
new Microsoft.Office.Interop.PowerPoint.Application();
Is it necessary to have full version of Office 2010 to be installed for this code to work ( I only have a Powerpoint Viewer installed ) or is there some other solution to this exception?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要安装完整的 PowerPoint 才能实现此目的。查看者无法操作 powerpoint 文件。
You need the full PowerPoint installed in order to achieve this. The viewer cannot manipulate powerpoint files.