我有这个代码:
Microsoft.Office.Interop.Excel.Application xla = new Microsoft.Office.Interop.Excel.Application();
xla.Visible = false;
Workbook wb = xla.Workbooks.Add(XlSheetType.xlWorksheet);
Worksheet ws = (Worksheet)xla.ActiveSheet;
ws.Name = "Serial";
int i = 1;
foreach (DataRow comp in dsView.Tables[0].Rows)
{
ws.Cells[i, 1] = "'" + comp[0].ToString();
ws.Cells[i, 2] = "'" + comp[1].ToString();
ws.Cells[i, 3] = "'" + comp[2].ToString();
i++;
}
if (File.Exists(@"d:\DDD.xlsx"))
File.Delete(@"d:\DDD.xlsx");
xla.Save(@"d:\DDD.xlsx"); ---->>>> on this line i get the error
错误:
HRESULT 异常:0x800A03EC
我正在使用 Office 2012处理 C# winforms