国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開(kāi)發(fā)設(shè)計(jì) > 正文

分頁(yè)Repeater導(dǎo)出數(shù)據(jù)到Excel

2019-11-09 21:15:30
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

分頁(yè)Repeater導(dǎo)出數(shù)據(jù)到Excel

1.導(dǎo)出Repeater中的數(shù)據(jù)時(shí),導(dǎo)出的數(shù)據(jù)必須是完整的數(shù)據(jù)塊,例如:完整的table。

2.如果導(dǎo)出的數(shù)字按科學(xué)計(jì)數(shù)法顯示則在那列加入樣式:style=”vnd.ms-excel.numberformat:@”即可。

3.Repeater導(dǎo)出到Excel的代碼(C#):

public static void ReportToExcel(System.Web.UI.Control ctl) { HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8; HttpContext.Current.Response.ContentType = "application/ms-excel"; HttpContext.Current.Response.Charset = "gb2312"; HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("Hello.xls", System.Text.Encoding.UTF8).ToString()); StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); ctl.RenderControl(htw); HttpContext.Current.Response.Write(sw.ToString()); HttpContext.Current.Response.End(); }

4.如果支持分頁(yè),并且頁(yè)面不是回發(fā)的情況下,可以用如下方法調(diào)用:

string where = string.Format("{0} and PayState=1", whereSQL);//根據(jù)需要,重新拼寫(xiě)where條件 DataTable dt = Function.PayDesigner.GetPayDesignerList(where, orderSQL, 1, recordCount); //recordCount為記錄的總條數(shù) Repeater1.DataSource = dt; Repeater1.DataBind(); ReportToExcel(Repeater1);
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 佛学| 凤翔县| 安国市| 伊春市| 会东县| 页游| 修文县| 阳信县| 明水县| 武功县| 陆河县| 太保市| 平原县| 南宫市| 湘阴县| 皮山县| 深州市| 泊头市| 新丰县| 会东县| 揭西县| 绥化市| 丹东市| 靖江市| 仙居县| 富顺县| 蕉岭县| 南丰县| 双城市| 台东市| 松阳县| 瑞丽市| 平原县| 乐昌市| 鲁甸县| 阿瓦提县| 南京市| 青河县| 阳江市| 吉林市| 沧州市|