日期:2014-05-18 浏览次数:20923 次
protected void ibtn_Excel_Click(object sender, ImageClickEventArgs e) { Response.Clear(); Response.Buffer = true; Response.Charset = "utf-8"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode("名称", System.Text.Encoding.UTF8) + ".xls"); Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); //设置输出流为简体中文 Response.ContentType = "application/ms-excel"; //设置输出文件类型为excel文件。 this.EnableViewState = false; System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true); System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad); System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter); // repeater控件的ID this.rpt_CEO.RenderControl(oHtmlTextWriter); Response.Write(oStringWriter.ToString()); Response.End(); }
#region CEO报表查询 /// <summary> /// CEO报表查询 /// </summary> /// <param name="timeBegin"></param> /// <param name="timeEnd"></param> /// <param name="page"></param> public void GetCEO(string timeBegin, string timeEnd, Page page) { try { Repeater rpt_CEO = (Repeater)page.FindControl("rpt_CEO"); DataSet ds; //= ViewState["DtDatat"] as DataTable; int ThisPage = PublicClass.thispages(); if (ThisPage < 1) ThisPage = 1; int pages = 0; int recordcount = 0; string WhereStr = "order_CreTime between '" + timeBegin + "'" + " and '" + timeEnd + "' and order_Status = 10";//接收参数语句 string text = Request.GetUrlPamars("text"); string WhereUrl = "Financial_Reports.aspx?text=" + text; List<string[]> OutList = new List<string[]>(); object[] Params = new object[11]; Params[0] = "Hotel_Order";//表名 Params[1] = "order_Id";//按该列来进行分页 Params[2] = "order_Id";//按该列来进行排序 Params[3] = 0;//列的类型 Params[4] = 0;//分页列排序,0-顺序,1-倒序 ; Params[5] = 0;//排序列排序,0-顺序,1-倒序 Params[6] = "*";//要查询出的字段列 Params[7] = 1;//每页记录数 Params[8] = ThisPage;//指定页 Params[9] = WhereStr;//条件 Params[10] = "Pagination";//分页存储过程名 //0:@tb varchar(100), --表名 ; 1:@col varchar(50), --按该列来进行分页; 2:@col1 varchar(50), --按该列来进行排序 ; 3:@coltype int, --@col列的类型,0-数字类型,1-字符类型,2-日期时间类型 ; 4:@orderby bit, --分页列排序,0-顺序,1-倒序 ; 5:@orderby1 bit, --排序列排序,0-顺序,1-倒序 ; 6:@collist varchar(800),--要查询出的字段列表,*表示全部字段 ; 7:@pagesize int, --每页记录数 ; 8:@page int, --指定页 ; 9:@condition varchar(800),--查询条件 ; 10:存储过程名 ds = Provider.DataSetList(true, out OutList, Params); rpt_CEO.DataSource = ds.Tables[0]; rpt_CEO.DataBind(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Literal