C#: Open Excel (.XLSX) WorkBook => COMException
I try to open a .XLSX file from VS2010 .NET 3.5 on a 64bit Windows 7.
Thats the code:
string fileName = string.Format("{0}\\test.xlsx", Directory.GetCurrentDirectory());
Application开发者_开发技巧 _excelApp = new ApplicationClass();
Workbook workBook = _excelApp.Workbooks.Open(fileName);
thats the error I get:
Old format or invalid type library. (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))
What do I wrong, I go nearly crazy... I tried everything I think at least...
I can't comment on the code, but from working with excel on server-side in the past, you can get a lot of COM+ permissions errors that lead to this sort of error. Check your event logs and go from there.
精彩评论