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];
你有调试吗?你是否谷歌错误? –