改成下面这样就行了
protected void Button1_Click(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer = true;
Response.Charset = "GB2312";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + DateTime.Now.ToString("yyyyMMdd") + ".xls");
Response.ContentEncoding = System.Text.Encoding.Default;//设置成默认的编码,用记事本打开导出的xls文件可以直接修改
Response.ContentType = "application/ms-excel";
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
oHtmlTextWriter.Write("
"+Label1.Text+" | ||||||
" + Label2.Text + " | " + Label3.Text + " |
先加分,我做好拉
楼上这位,太过分了吧
为了分才帮人家?