Error:The type or namespace name 'Office' does not exist in the namespac

Error:The type or namespace name Office does not exist in the namespace Microsoft 解决方法在vs里面:

Error:The type or namespace name 'Office' does not exist in the namespace 'Microsoft' 解决方法

在vs里面:

Website->AddReference->.NET->Microsoft.Office.Interop.Excel.

设置之后即可。