先添加引用,然后照如下代码using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.OracleClient; using Excel = Microsoft.Office.Interop.Excel;就ok了(注意这里把其他的引用页a粘出来是为了告诉你位置)
Interop.Microsoft.Office.Core.dll Interop.Office.dll Interop.Excel.dll ...... 要添加这几个参考,然后 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; using Excel = Microsoft.Office.Interop.Excel;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;
using Excel = Microsoft.Office.Interop.Excel;就ok了(注意这里把其他的引用页a粘出来是为了告诉你位置)
在文件form1.Designer.cs中有如下声明:
private Excel.Application ExcelObj = null;
你这样using Microsoft.Office.Interop.Excel;不行的。
Interop.Office.dll
Interop.Excel.dll
......
要添加这几个参考,然后
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using Excel = Microsoft.Office.Interop.Excel;