62,046
社区成员
发帖
与我相关
我的任务
分享
Response.Charset = "GB2312";
Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8) + ".xls");
Response.Charset = "GB2312";
Response.ContentType = "application/ms-excel";//设置输出文件类型为excel文件。
Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8) + ".xls");
。。。
Response.Charset = "GB2312";
Response.ContentEncoding = Encoding.UTF7;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());
Response.ContentType = FileType;
this.EnableViewState = false;
this.GridView1.AllowPaging = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN", true);
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
this.GridView1.RenderControl(htw);
Response.Write(style);
Response.Write(sw.ToString());
Response.End();
。。。
Response.Clear();
Response.Buffer = true;
Response.Charset = "GB2312";
Response.ContentType = "application/vnd.ms-excel";
Response.ContentEncoding = Encoding.UTF8;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.GetEncoding("gb2312")).ToString());
this.EnableViewState = false;
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView gv = new GridView();
gv.DataSource = dt;
gv.DataBind();
gv.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();