在服务器上安装没有Office的Office Interops

oli*_*dev 2 excel interop

我正在使用Excel Interop更改excel单元格.

我尝试过许多开源解决方案但是文件在阅读时已损坏.因此,我坚持使用Excel Interop.

在服务器上进行开发时,我遇到了这个问题:

Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Run Code Online (Sandbox Code Playgroud)

因此,我想在我的服务器上安装Office interop: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=18346

但是,当我安装它时,我遇到了这个问题:

"请在安装此产品之前安装Microsoft Office 2007"

我的问题是:是否可以在服务器上没有Office 2007的情况下安装互操作?

提前致谢.

Roy*_*tus 6

不,这是不可能的.Office Interop只是一种访问(COM)Office组件的.NET方法.所以他们必须在那里,或者Office Interop没有理由在那里.

如果要开发读/写Office文件的应用程序,可以使用OpenXML(另请参阅http://en.wikipedia.org/wiki/Office_Open_XML)和非官方的ClosedXML(http://closedxml.codeplex.com/)或第三方组件,如SmartXLS(http://www.smartxls.com/).