2015-06-20 81 views
0

Iam尝试使用datagridview中的信息创建excel文件,该数据从db获取。但我从HRESULT以下错误异常:0x800A03EC”(System.Runtime.InteropServices.COMException)...的错误似乎是在与线**创建excel数据表时出错0x800A03EC

的代码是一个按钮,点击之内

 Microsoft.Office.Interop.Excel.Application excel1 = new Microsoft.Office.Interop.Excel.Application { }; 

     Workbook work1 = excel1.Workbooks.Add(XlSheetType.xlWorksheet); 
     Worksheet ws1 = (Worksheet)excel1.ActiveSheet; 

     excel1.Visible = true; 

     ws1.Cells[1,1] = "ID"; 
     ws1.Cells[1,2]= "NAME"; 


     ** ws1.Cells[1,1]= dataGridView1[1,1]; 
     ws1.Cells[1, 2] = dataGridView1[1,2]; 
+0

你有调试吗?你是否谷歌错误? –

回答

0

有看到可用引用,例如:

这些只是几个来看看。