Accessing Interop.office.excel library from asp.net web application

吃可爱长大的小学妹 提交于 2019-12-12 03:19:24

问题


i have an asp.net web application and deployed on web server. in a scenario i have a fixed format excel sheet which is on server in a web folder. at runtime i m writing in cell with the help of interop.office.excel library. initially there was no excel installed on server then we have installed excel and given COM component full rights from Component services. but now we are getting below error. How to solve this ?

Detection of product '{90110409-6000-11D3-8CFE-0150048383C9}', feature 'OfficeUserData', component '{4A31E933-6F67-11D2-AAA2-00A0C90F57B0}' failed. The resource 'HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\MS Access Database\' does not exist.

Detection of product '{90110409-6000-11D3-8CFE-0150048383C9}', feature 'ExcelUserData', component '{8ADD2C96-C8B7-11D1-9C67-0000F81F1B38}' failed. The resource 'HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\UserData' does not exist.


回答1:


Interop is not supported in sever-scenarios (like ASP.NET) by MS.

There are many options to read/edit/create Excel files without Interop:

MS provides the free OpenXML SDK V 2.0 - see http://msdn.microsoft.com/en-us/library/bb448854%28office.14%29.aspx (XLSX only)

This can read+write MS Office files (including Excel).

Another free option see http://www.codeproject.com/KB/office/OpenXML.aspx (XLSX only)

IF you need more like handling older Excel versions (like XLS, not only XLSX), rendering, creating PDFs, formulas etc. then there are different free and commercial libraries like ClosedXML (free, XLSX only), EPPlus (free, XLSX only), Aspose.Cells, SpreadsheetGear, LibXL and Flexcel etc.



来源:https://stackoverflow.com/questions/9699311/accessing-interop-office-excel-library-from-asp-net-web-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!