In asp.net, operations such as excel do not exist or the namespace name Office

Source: Internet
Author: User

In a Program in the afternoon, I want to import an EXCEL table, but it displays

1. There is no type or namespace name Office in the namespace Microsoft (is the Assembly reference missing ?)

2. There is no type or namespace name Interop in the namespace Microsoft (is it missing Assembly reference ?)

It is very troublesome. After searching by multiple parties, we can finally solve the problem and study after leaving notes.

 

The first thing to do is to add references (download online)

Microsoft. Office. Interop. Excel. dll

Microsoft. Office. Interop. SmartTag. dll

Microsoft. Office. Interop. Word. dll

Add as needed.

It is worth noting that:

 

In VS2010, when COM components are referenced, the "…", Use the error message of the applicable interface instead. Check the information and find the solution. The record is as follows:

Right-click the dll introduced in the project, select properties, and set "embedded interoperability type" to False.

 

In this way, there should be no problem. If there is no problem, you don't have to look at the following.

 

 

If the problem persists:

 

1. There is no type or namespace name "Office" in the namespace "Microsoft" (is the Assembly reference missing ?)

 

Method 1 (if you have installed. net FrameWork1.1 and Office2003)

 

1. Insert the office2003 disk and select "delete add program" (which seems to be called this) --> advanced -->

Microsoft office ---> Microsoft office Excel --> Run all programs (Word, PPT, and so on) from the local machine)

 

2 Microsoft office --> office tools --> MicroSoft Forms 2.0.net programmable support --> Run all programs from the Local Machine

 

3 Microsoft office --> office tools --> Smart Tag plug-in --> Run all programs from the Local Machine

 

4. After the update is complete, open visual 2008 to add reference, "C: // Program Files // common Files //

Microsoft Shared // Office10 // MSO. DLL ", add" Microsoft. Office. Core ".

 

5 OK

 

 

Method 2 reinstall Office2003 directly and follow the steps in method 1.

 

 

2. The namespace "Microsoft" does not contain a type or the namespace name "Interop" (is the Assembly reference missing ?)

After completing the first step,

Find "Reference", right-click --> Add reference -----> microSoft. Office. Interop. Excel 11 (or 12) (. Net) to import.

 

Let's see, is it OK?

 

From IT fat Column
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.