将VS中的倒到EXCEL中去
											怎么将VS DATAGRID中的数据道入EXCEL中啊 大哥们 帮帮忙啊
怎么将VS DATAGRID中的数据道入EXCEL中啊 大哥们 帮帮忙啊
 2006-11-08 19:39
	    2006-11-08 19:39
   2006-11-09 08:34
	    2006-11-09 08:34
   2006-11-09 10:00
	    2006-11-09 10:00
   2006-11-09 10:20
	    2006-11-09 10:20
  那是vs2003 我知道 05的就不同了
 2006-11-10 19:40
	    2006-11-10 19:40
        Excel.Application excel = new Excel.ApplicationClass();
            excel.Application.Workbooks.Add(true);
   excel.Visible = true;
   
            int colindex = 0;
   foreach(DataColumn dc in dt.Columns)
   {
    colindex ++;
    excel.Cells[1,colindex] = dc.ColumnName;
   }
   int rowindex = 1;
   foreach(DataRow dr in dt.Rows)
   {
    rowindex ++;
    colindex = 0;
    foreach(DataColumn col in dt.Columns)
    {
     colindex ++;
     excel.Cells[rowindex,colindex] = dr[col.ColumnName].ToString();
    }
   }
   Conn.Close();
  }

 2006-11-10 19:47
	    2006-11-10 19:47