**如下:
"學員建議--"&
me.coursename, system.text.encoding.utf8) &"
.xls")
5response.contentencoding
=system.text.encoding.getencoding(
"gb2312")
6response.contenttype ="
"7dlstgetandsuggest.enableviewstate
=false
8dimmycitrad
asnew
system.globalization.cultureinfo(
"zh-cn",
true)9
dimostringwriter
asnew
system.io.stringwriter(mycitrad)
10dimohtmltextwriter
asnew
system.web.ui.htmltextwriter(ostringwriter)
11me.dlstgetandsuggest.rendercontrol(ohtmltextwriter)
12response.write(ostringwriter.tostring())
13response.end()
說明:第4行,如果把檔名直接寫作字串格式,在匯出時檔名會出現亂碼,用httputility.urlencode("學員建議--" & me.coursename, system.text.encoding.utf8),可以防止檔名為亂碼。
第3行和第5行,防止原文中的內容匯出到excel檔案時出現亂碼。
從資料庫匯出資料到word excel txt
獲得資料集dataset 用於除錯 dataset 把資料檔案匯入到.xls檔案 public void exporttoexcel dataset ds catch 讓生成的excel檔案可見 myexcel.visible true catch exception e else 把資料匯入到.d...
從資料庫匯出資料到word excel txt
原創說明內容如下 在vs環境下選擇office元件時要在引用的com元件中選擇,不能選擇.net元件中的office元件。以上說明為重點,vs2008在.net元件組中也有office元件部分的內容,那樣的話就只能在開發環境下使用了。using system using system.data us...
從radgird中匯出資料到excle
前台設 autogeneratecolumns false 後台private void configurereport string strexporttype 有這兩句才可以把全部資料匯出來,而其他的不匯出來 radgrid2.exportsettings.exportonlydata true...