导入Microsoft.Office.Interop.Excel命名空间

时间:2013-06-06 21:22:42

标签: asp.net iis excel-automation

我需要在ASP.NET Web应用程序中使用excel自动化。我试图使用以下代码在.aspx文件中导入它: <%@ Import Namespace="Microsoft.Office.Interop.Excel" %>但是,当我在浏览器中打开页面时,我收到错误The type or namespace name 'Office' does not exist in the namespace 'Microsoft'。所以我假设我必须在我的项目中添加一些库。我使用IIS 7.5创建此Web应用程序,而不是Visual Studio。那么有没有办法将外部库导入IIS中的ASP.NET项目?

2 个答案:

答案 0 :(得分:1)

右键单击Reference - .Net选项卡--Microsoft.Office.Interop.Excel

Excel 2010使用版本14 / Excel 2007使用版本12

点击确定。

答案 1 :(得分:0)

您应该能够将Microsoft.Office.Interop.Excel.dll放入bin目录。如果这不起作用,请尝试将其添加到<assemblies>文件中的web.config

Assemblies in Web.config