using System.IO; using System.Reflection;
DataSet ds=new DataSet(); ds=(DataSet)(this.dataGrid1.DataSource); Excel.Application myExcel = new Excel.Application ( ) ; myExcel.Application.Workbooks.Add ( true ) ; myExcel.Visible=true; myExcel.Cells[1,4]="title";
if(ds == null) return; for(int i=0;i<ds.Tables[0].Rows.Count;i++) { for(int j=0;j<ds.Tables[0].Columns.Count;j++) { myExcel.Cells[4+i,1+j]="'"+ds.Tables[0].Rows[j]; } }
|