【发布时间】:2015-11-24 18:24:47
【问题描述】:
我正在尝试使用从数据库获得的 datagridview 中的信息创建一个 excel 文件。但我从 HRESULT 收到以下错误 Exception: 0x800A03EC" (System.Runtime.InteropServices.COMException)... 该错误似乎符合 **
代码在按钮点击内
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];
【问题讨论】:
-
你调试了吗?你用谷歌搜索了错误吗?
标签: c# datagridview