ole32.dll DllNotFoundException

时间:2013-09-10 09:27:32

标签: c# mono ubuntu-12.04 excel-interop

有没有办法在Ubuntu中使用Excel / Office库?

我开发了一个C#程序,它将Excel电子表格和一些VB宏粘合在一起。它使用以下内容。

Excel和Office库:Microsoft.Vbe.Interop.dll Microsoft.Office.Interop.Excel.dll和Office.dll。它在Windows中完美运行,但我无法使用Mono 3.2在Ubuntu上运行它。

当我尝试执行它时(在添加我使用gacutil -l XXXX.dll显式导入的库之后) 输出如下:

[ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: ole32.dll
  at (wrapper managed-to-native) System.__ComObject:CoCreateInstance (System.Guid,intptr,uint,System.Guid,intptr&)
  at System.__ComObject.Initialize (System.Type t) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.__ComObject:Initialize (System.Type)
  at Mono.Interop.ComInteropProxy.CreateProxy (System.Type t) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.RemotingServices.CreateClientProxyForComInterop (System.Type type) [0x00000] in <filename unknown>:0 
  at System.Runtime.Remoting.Activation.ActivationServices.CreateProxyForType (System.Type type) [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0 
  at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0 
  at MyProgram.Program.joinMacroAndExcel () [0x00000] in <filename unknown>:0 
  at MyProgram.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

任何帮助或指示都将受到高度赞赏。提前致谢。

约什

1 个答案:

答案 0 :(得分:0)

Excel / Office集成库要求已经安装Office才能运行 - 只是复制PIA(例如Microsoft.Office.Interop.Excel.dll)是不够的,因为它们充当了暴露的COM层的桥梁由Excel等人。如果没有COM层,就无法执行您所要求的工作。