using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class xls : System.Web.UI.Page
{
public static string strtemp = "";
protected void Page_Load(object sender, EventArgs e)
{
strtemp = "";
strtemp += "字段1\t字段2\t字段3\n";
strtemp += "a\tb\tc\n";
}
protected void Button1_Click(object sender, EventArgs e)
{
HttpResponse resp = Page.Response;
resp.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
resp.AppendHeader("Content-Disposition", "attachment;filename=dzdys.xls");
HttpContext.Current.Response.ContentType = "application/ms-excel";
resp.Write(strtemp);
resp.End();
}
}