【发布时间】:2015-06-24 11:08:33
【问题描述】:
我只是想通过这样做来制作一个空的幻灯片对象-
Microsoft.Office.Interop.PowerPoint.Slide empty_slide = new Microsoft.Office.Interop.PowerPoint.Slide();
错误是:
Unhandled Exception: System.Runtime.InteropServices.COMException: Retrieving the
COM class factory for component with CLSID {91493445-5A91-11CF-8700-00AA0060263
B} failed due to the following error: 80040154 Class not registered (Exception f
rom HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOn
ly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Bo
olean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipChec
kThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean s
kipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Program.GetBulletPointTransition(Application PowerPoint_App, Presentation
presentation) in c:\Users\PEAK\Documents\Peak Sourcing\Work\ppt_test\ppt_test\Pr
ogram.cs:line 539
at Program.Main(String[] args) in c:\Users\PEAK\Documents\Peak Sourcing\Work\
ppt_test\ppt_test\Program.cs:line 79
Press any key to continue . . .
我将不胜感激。
【问题讨论】:
-
你为什么将它设置为空? null 与空幻灯片不同!错误是什么?
-
它说的是“未设置为对象的实例”。好的,我应该把它设置成什么?
-
var empty_slide = new Microsoft.Office.Interop.PowerPoint.Slide(); -
Null 是一个对象的缺失,而不是一个空对象的替代品(尽管不幸的是,它们有时会被这样使用)。
标签: c# powerpoint