I'm maintaining a web-app which currently references Interop.Excel.dll (v 1.5.0.0).
The Interop.Excel.dll been used to access .xls files under Excel 2003 and then, subsequently, .xlsx/m files under Excel 2010. All worked fine.
The web-app got moved onto another machine (which has Excel 2003 with 'Office 2007 Compatability Pack' installed) and is now unable to open .xlsx/m files (stacktrace of error the occurs shown below).
There's no problem about a human opening .xlsx/m files on that machine other than you see the little Compatability Pack 'converting' dialog for a moment as the file is opened.
Is there some known limitation of combining : Excel 2003; 'Office 2007 Comp Pack'; and .xlsx/m files ?
STACKTRACE
2013-04-23 16:03:00.7192|Error|An error occurred in OpenCloseManager. Details Follow:
Exception Type ---
System.Runtime.InteropServices.COMException
Message ---
The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
HelpLink ---
Source ---
Interop.Excel
StackTrace ---
at Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
at TCG.CRRExDBInterface.BO.SpreadSheetHelper.manageExcelOpen(Boolean blnUpdateLinks) in D:\foo\ExcelDBInterface-4.7.1.0\ExcelDBInterface-4.7.1.0\ExcelDBInterface\CRRExDBInterface\App_Code\BusinessObject\SpreadSheetHelper.cs:line 1920
TargetSite ---
Excel.Workbook Open(System.String, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object, System.Object)|MasterSubPage.parseSecurityInfoFromSpreadsheetAndSave => SpreadSheetHelper..ctor => SpreadSheetHelper.manageExcelOpen
Brave soul was the one to put office interop in a web app. If you check the documentation using the COM API is not recommended on a server for a two main reasons:
In either case I doubt the version of Excel is where your problem is.
If I were you I'd recommend to "management" to upgrade the app with OpenXmlSDK. It's not an easy switch but depending on your circumstances it can be worth its while - you can multithread, no hanging hidden instances etc, it's much faster, you have good control over what's happening. The drawbacks are a steep learning curve, lack of copy/paste type of functionality - one has to work around
Well for it's worth (and to give this question some resolution) I gave up trying to use the old machine and moved to the machine with Excel 2010 installed. Not really an answer at all but, I hope, some indication to others that it wasn't solvable with the resources I had to hand.
User contributions licensed under CC BY-SA 3.0