Excel.Application exApp = new Excel.ApplicationClass();
Workbook exBook = exApp.Workbooks.Add(true);
Worksheet exSheet = exBook.Worksheets[1] as Worksheet;
exApp.Visible = true; for (int i = 0; i < ds.Tables[dsName].Columns.Count; i++)
{
for (int j = 0; j < ds.Tables[dsName].Rows.Count; j++)
{
// ds.Tables[dsName].Rows[j][i].ToString();
exSheet.Cells[j, i] = "123";
}
}
exBook.SaveAs(@"+ Path +", System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value,
Excel.XlSaveAsAccessMode.xlNoChange, System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value);
exApp.Quit();
exApp = null;在exSheet.Cells[j, i] = "123";
发生错误!为什么!
Workbook exBook = exApp.Workbooks.Add(true);
Worksheet exSheet = exBook.Worksheets[1] as Worksheet;
exApp.Visible = true; for (int i = 0; i < ds.Tables[dsName].Columns.Count; i++)
{
for (int j = 0; j < ds.Tables[dsName].Rows.Count; j++)
{
// ds.Tables[dsName].Rows[j][i].ToString();
exSheet.Cells[j, i] = "123";
}
}
exBook.SaveAs(@"+ Path +", System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value,
Excel.XlSaveAsAccessMode.xlNoChange, System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value);
exApp.Quit();
exApp = null;在exSheet.Cells[j, i] = "123";
发生错误!为什么!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货