怎样将更新的数据dataset导入到Excel http://support.microsoft.com/default.aspx?scid=kb;zh-cn;317719 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 private void daochu_all() { int i = 0; int j = 1; try { Excel.Application excel = new Excel.Application() ; excel.Application.Workbooks.Add(true); //excel.Visible = true; try { excel.Caption = "提成合计表"; excel.Cells[j,2] = myds.Tables["A"].Rows[i]["会计期间"].ToString().Substring(0,4)+"年"+ myds.Tables["A"].Rows[i]["会计期间"].ToString().Substring(4,2)+"月提成合计表"; j++; excel.Cells[j,1] = "会计期间"; excel.Cells[j,2] = "部门编号"; excel.Cells[j,3] = "部门名称"; excel.Cells[j,4] = "人员编码"; excel.Cells[j,5] = "人员姓名"; excel.Cells[j,6] = "手工提成"; excel.Cells[j,7] = "本月提成"; excel.Cells[j,8] = "以前月份提成调整"; excel.Cells[j,9] = "串货划拨提成"; excel.Cells[j,10] = "剩余提成二次分配"; excel.Cells[j,11] = "本月提成合计"; excel.get_Range(excel.Cells[j,1],excel.Cells[j,11]).Borders.LineStyle = 1; j++; excel.Cells[j,1] = "1"; excel.Cells[j,2] = "2"; excel.Cells[j,3] = "3"; excel.Cells[j,4] = "4"; excel.Cells[j,5] = "5"; excel.Cells[j,6] = "6"; excel.Cells[j,7] = "7"; excel.Cells[j,8] = "8"; excel.Cells[j,9] = "9"; excel.Cells[j,10] = "10"; excel.Cells[j,11] = "11=6+7+8+9+10"; excel.get_Range(excel.Cells[j,1],excel.Cells[j,11]).Borders.LineStyle = 1; j++; for (i=0;i<myds.Tables["A"].Rows.Count;i++) { excel.Cells[j,1] = myds.Tables["A"].Rows[i]["会计期间"].ToString(); excel.Cells[j,2] = "'"+myds.Tables["A"].Rows[i]["部门编号"].ToString(); excel.Cells[j,3] = myds.Tables["A"].Rows[i]["部门名称"].ToString(); excel.Cells[j,4] ="'"+ myds.Tables["A"].Rows[i]["人员编码"].ToString(); excel.Cells[j,5] = myds.Tables["A"].Rows[i]["人员姓名"].ToString(); excel.Cells[j,6] = myds.Tables["A"].Rows[i]["手工提成"].ToString(); excel.Cells[j,7] = myds.Tables["A"].Rows[i]["本月提成"].ToString(); excel.Cells[j,8] = myds.Tables["A"].Rows[i]["以前月份提成调整"].ToString(); excel.Cells[j,9] = myds.Tables["A"].Rows[i]["串货划拨提成"].ToString(); excel.Cells[j,10] = myds.Tables["A"].Rows[i]["剩余提成二次分配"].ToString(); excel.Cells[j,11] = myds.Tables["A"].Rows[i]["本月提成合计"].ToString(); excel.get_Range(excel.Cells[j,1],excel.Cells[j,11]).Borders.LineStyle = 1; j++; } j++; j++; MessageBox.Show("数据导出完毕。"); this.Close(); excel.Visible = true; } catch (Exception ex) { MessageBox.Show(ex.Message); excel.Quit(); } } catch (Exception ex) { MessageBox.Show("没有安装EXCEL。"+"\n"+ex.Message); } finally { this.dcbz = false; } } iframe框架下子页面刷新问题 登录窗体 调节亮度 一个线程执行后的提示问题? 如何在信息框显示文本变量 C#与 PROCEDURE的问题 请教如何将C#中打印的内容保存到剪切板? COm+组件安装问题 急! 新手问题,用byte[]接收网络流, 然后byte[]转成string string多出N个\0,谢谢 高分寻求打印最快速度方案,一张票据客户要求最慢不超过五秒!急!! 郁闷的正则表达式,各位,帮忙看看, 按钮文字显示不全
{
int i = 0;
int j = 1;
try
{
Excel.Application excel = new Excel.Application() ;
excel.Application.Workbooks.Add(true);
//excel.Visible = true;
try
{
excel.Caption = "提成合计表";
excel.Cells[j,2] = myds.Tables["A"].Rows[i]["会计期间"].ToString().Substring(0,4)+"年"+
myds.Tables["A"].Rows[i]["会计期间"].ToString().Substring(4,2)+"月提成合计表";
j++;
excel.Cells[j,1] = "会计期间";
excel.Cells[j,2] = "部门编号";
excel.Cells[j,3] = "部门名称";
excel.Cells[j,4] = "人员编码";
excel.Cells[j,5] = "人员姓名";
excel.Cells[j,6] = "手工提成";
excel.Cells[j,7] = "本月提成";
excel.Cells[j,8] = "以前月份提成调整";
excel.Cells[j,9] = "串货划拨提成";
excel.Cells[j,10] = "剩余提成二次分配";
excel.Cells[j,11] = "本月提成合计";
excel.get_Range(excel.Cells[j,1],excel.Cells[j,11]).Borders.LineStyle = 1;
j++;
excel.Cells[j,1] = "1";
excel.Cells[j,2] = "2";
excel.Cells[j,3] = "3";
excel.Cells[j,4] = "4";
excel.Cells[j,5] = "5";
excel.Cells[j,6] = "6";
excel.Cells[j,7] = "7";
excel.Cells[j,8] = "8";
excel.Cells[j,9] = "9";
excel.Cells[j,10] = "10";
excel.Cells[j,11] = "11=6+7+8+9+10";
excel.get_Range(excel.Cells[j,1],excel.Cells[j,11]).Borders.LineStyle = 1;
j++;
for (i=0;i<myds.Tables["A"].Rows.Count;i++)
{
excel.Cells[j,1] = myds.Tables["A"].Rows[i]["会计期间"].ToString();
excel.Cells[j,2] = "'"+myds.Tables["A"].Rows[i]["部门编号"].ToString();
excel.Cells[j,3] = myds.Tables["A"].Rows[i]["部门名称"].ToString();
excel.Cells[j,4] ="'"+ myds.Tables["A"].Rows[i]["人员编码"].ToString();
excel.Cells[j,5] = myds.Tables["A"].Rows[i]["人员姓名"].ToString();
excel.Cells[j,6] = myds.Tables["A"].Rows[i]["手工提成"].ToString();
excel.Cells[j,7] = myds.Tables["A"].Rows[i]["本月提成"].ToString();
excel.Cells[j,8] = myds.Tables["A"].Rows[i]["以前月份提成调整"].ToString();
excel.Cells[j,9] = myds.Tables["A"].Rows[i]["串货划拨提成"].ToString();
excel.Cells[j,10] = myds.Tables["A"].Rows[i]["剩余提成二次分配"].ToString();
excel.Cells[j,11] = myds.Tables["A"].Rows[i]["本月提成合计"].ToString();
excel.get_Range(excel.Cells[j,1],excel.Cells[j,11]).Borders.LineStyle = 1;
j++;
}
j++;
j++;
MessageBox.Show("数据导出完毕。");
this.Close();
excel.Visible = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
excel.Quit();
}
}
catch (Exception ex)
{
MessageBox.Show("没有安装EXCEL。"+"\n"+ex.Message);
}
finally
{
this.dcbz = false;
}
}