-1

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

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

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

任何帮助或指导将不胜感激。提前致谢。

乔什

4

1 回答 1

0

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

于 2013-09-11T07:56:47.753 回答