开发者

C#: Open Excel (.XLSX) WorkBook => COMException

开发者 https://www.devze.com 2023-01-30 13:39 出处:网络
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());

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消