Response.Charset = "GB2312";
Response.ContentEncoding = System.Text.Encoding.UTF7;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());
Response.ContentType = FileType;
this.EnableViewState = false;
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
GridView1.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
导出的execl头标题为粗体(我想要不是粗体的)比如gridview中 数据列值为01 ,02 而到execl中数据变为1 ,2 怎么修正 大家帮帮我
Response.ContentEncoding = System.Text.Encoding.UTF7;
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(FileName, Encoding.UTF8).ToString());
Response.ContentType = FileType;
this.EnableViewState = false;
StringWriter tw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(tw);
GridView1.RenderControl(hw);
Response.Write(tw.ToString());
Response.End();
导出的execl头标题为粗体(我想要不是粗体的)比如gridview中 数据列值为01 ,02 而到execl中数据变为1 ,2 怎么修正 大家帮帮我
gridview中 数据列值为01 ,02 而到execl中数据变为1 ,2 问题 protected void Button2_Click1(object sender, EventArgs e)
{
// Export("application/ms-excel", "兑奖报表.xls"); string style = @"<style> .text { mso-number-format:\@; } </script> ";
Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls"); Response.ContentType = "application/excel"; StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); GridView1.RenderControl(htw); Response.Write(style); Response.Write(sw.ToString()); Response.End(); }
if (e.Row.RowType == DataControlRowType.DataRow)
{ e.Row.Cells[2].Attributes.Add("class", "text");
e.Row.Cells[4].Attributes.Add("class", "text"); } 解决 谢谢给位朋友