將DataGrid中的資料轉換為Excel c

2021-04-13 11:55:55 字數 604 閱讀 8587

if (gridx.tablestyles.count>0) }

objarr = new object[ivisable];

objarr=list.toarray();

excelcell = xst.get_range(excel.cells[1,1],excel.cells[1,ivisable]);

excelcell.value2 = objarr;

//資料行

for(i=0;ifor(j=0;j0) }

if (list.equals(system.dbnull.value))

objarr=list.toarray();

excelcell = xst.get_range(excel.cells[i+2,1],excel.cells[i+2,ivisable]);

excelcell.value2 = objarr;

} }

else

} dttest.dispose();

excel.visible=true;

} catch (system.exception e)

finally

將DataGrid中的資料匯出為Excel的方法

utils.cs 檔案內容 using system using system.data using system.configuration using system.web using system.web.security using system.web.ui using system.we...

將DataGrid中的資料完全匯入到EXCEL中

今天晚上開始測試,以前做過一次,但是很不完美。大致 如下 匯入excel中,button的click事件 private void excel btn click object sender,system.eventargs e 如果有格式轉化問題,在itemdatabound事件中寫 if e.i...

將DataGrid資料寫入Excel檔案

程式 this.enableviewstate false system.globalization.cultureinfo mycitrad new system.globalization.cultureinfo zh cn true system.io.stringwriter ostring...