repeater匯出為excel格式
資料繫結到repeater1 ,下面是將repeater1的內容匯出的示例**
system.io.stringwriter sw
=new
system.io.stringwriter();
system.web.ui.htmltextwriter hw
=new
system.web.ui.htmltextwriter(sw);
this
.repeater1.rendercontrol(hw);
response.clear();
response.contenttype ="
";response.charset =""
;page.enableviewstate
=false
"content-disposition",
"attachment;filename=teacher.xls");
response.write(""
);response.write(sw.tostring());
response.write(
" "
);response.end();
說明:當字元型的數字串匯出到excel的時候,經常自動變為科學記數法表示,解決的方法,繫結到repeater1的時候如此:
<
td style="
vnd.ms-excel.numberformat:@
"><%
# databinder.eval(container.dataitem,
"shenfenzheng")
%>
td>
Repeater匯出為excel格式
資料繫結到repeater1 下面是將repeater1的內容匯出的示例 system.io.stringwriter sw new system.io.stringwriter system.web.ui.htmltextwriter hw new system.web.ui.htmltextwr...
Repeater 匯出為excel格式
stringwriter sw new stringwriter htmltextwriter hw new htmltextwriter sw this.rptsaleorder.rendercontrol hw response.clear response.charset rptsaleord...
將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...