使用.NET Core在Mac OSX上进行Office(Excel)COM互操作? [英] Office (Excel) COM interop on Mac OSX using .NET Core?

查看:196
本文介绍了使用.NET Core在Mac OSX上进行Office(Excel)COM互操作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为一个目前致力于在C#/.NET中创建Windows桌面应用程序的团队工作,该应用程序通过Office COM Interop与Microsoft Excel的本地用户实例进行交互.我目前负责指定新产品,但是有人告诉我,除非该应用程序可以在Mac和Windows上运行,否则该项目将无法继续进行-也就是说,我们必须能够生产该应用程序的Mac版本可以本地安装在OSX上并与Microsoft Excel for Mac用户实例的对象模型进行交互.

I work for a team that currently specializes in creating windows desktop applications in C#/.NET that interwork with local user instances of Microsoft Excel via Office COM Interop. I am currently charged with specifying a new product but I’ve been told that the project will not go ahead unless the app can run on Mac as well as Windows – that is, we have to be able to produce a Mac version of the app that can install natively on OSX and interact with the object model of a user’s instance of Microsoft Excel for Mac.

使用Parallels,Mono或Wine运行应用程序(请参阅OSX中的 COM Interop Through Wine) (从未得到答复))不是解决方案,因为该应用程序的规范要求不得以任何方式修改用户计算机.我们只需要假设用户正在运行许可的Excel本地副本,然后使用该副本……这就是我们在Windows上一贯所做的,效果很好.

Running the app with Parallels, Mono or Wine (see COM Interop Through Wine in OSX, which was never answered) is not a solution because the spec for the app requires that the user machine is not modified in any way. We just have to assume the user has a licenced local copy of Excel running, and work with that… which is what we have always done on Windows, where it works great.

我认为.NET Core是答案,但我找不到任何地方可以肯定地表明,当在具有本地操作系统的Mac OSX上运行.NET Core时,我们可以(或将能够)从C#访问Excel对象库.已安装Mac版Excel的副本.有人可以指出我已经讨论过的地方吗?但是如果没有,那么告诉我,如果这在他们的.NET Core路线图中,我该如何去向Microsoft查找?

I think .NET Core is the answer but I can’t find anywhere where it says definitely that we can (or will be able to) access the Excel Object Library from C# when running .NET Core on Mac OSX with a local copy of Excel for Mac installed. Can anybody point me please to where this has been discussed already; but if not, then tell me how I can go about finding out from Microsoft if this is in their roadmap for .NET Core?

推荐答案

我从MSDN上一个措辞类似的问题中收到了一些有用的反馈.我还在.NET Core Github上发布了一个问题,但我认为答案很清楚,如下所示:

I have received some helpful feedback from a similarly worded question on MSDN. I have also posted an issue on the .NET Core Github, but I think it is already clear what the answer is to this, which is as follows:

  • .NET Core团队也许可以说服在.NET Core类库中添加对Office.Interop.Excel命名空间的访问,但仅适用于Windows
  • 对于OSX上的.NET Core,无法完成此操作,因为环境是 不适合交换COM对象.
  • 这只剩下两个选项来处理Excel中的对象 Mac,两者均已存在:嵌入式VBA或Javascript(Office 加载项).
  • Office Addins是面向Web驱动的面向数据的出色的新解决方案 Excel中的对象-它的多平台性质很棒-因此正在享受 Microsoft开发.但是,它不打算是任何 与COM的性能相匹配,以管理复杂的电子表格, 因为这不是它的重点.
  • 这意味着没有解决方案可用于在Excel中管理对象 对于使用C#的Mac,就像在Windows上一样 似乎没有任何前景.
  • The .NET Core team may perhaps be persuadable to add access to the Office.Interop.Excel namespace in the .NET Core Class library, but only for Windows
  • This cannot be done for .NET Core on OSX because the environment is not suitable for interchanging COM objects.
  • This leaves only two options for manipulating objects in Excel for Mac, both of which already exist: Embedded VBA or Javascript (Office Add-ins).
  • Office Addins is a great new solution for web-driven data-oriented objects in Excel - and its multiplatform nature is awesome - so is enjoying the main focus of development from Microsoft. However it is not intended to be any match for the performance of COM for managing complex spreadsheets, since that's not its focus.
  • Which means there is no solution for managing objects within Excel for Mac using C#, in the way that there is on Windows, and there doesn't appear to be any prospect of one.

最重要的是:由于OSX上的体系结构限制,非常受欢迎的.NET Core计划看起来像是一个修复程序,但遗憾的是没有.

The bottom line: The very welcome .NET Core initiative looked like it was a fix, but sadly isn't, because of architecture limitations on OSX.

我将其作为答案提交,因为我想我已经结束对它的询问了,但是如果有人认为以上任何内容都不正确,请大喊大叫!

I have submitted this as an answer because I think I've come to the end of the line of enquiry on it, but if anyone thinks any of the above is incorrect, please shout!

谢谢.

这篇关于使用.NET Core在Mac OSX上进行Office(Excel)COM互操作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆