本帖最后由 gongxiaoyong 于 2012-06-07 17:30:23 编辑

解决方案 »

  1.   

    我常用的做法是,直接将后台数据,比如C#中的DataTable在后台构造为html的<table>然后输出。没有必要去用EXTJS转,那样太麻烦。
    下面代码是输出的。        Response.Clear();
            Response.ClearHeaders();
            Response.ClearContent();
            Response.AddHeader("content-disposition", "attachment;filename=Statistics.xls");
            Response.Charset = "gb2312";
            Response.ContentType = "application/Statistics.xls";
            System.IO.StringWriter stringWrite = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
            Response.Write("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=utf-8\">");
            Response.Write(strTable);  //表
            Response.Write("</body></html>");
            Response.End(); 构造就不说了
    其中strTable就是
    <table>
        <tr>
            <td>
            </td>
        </tr>
    </table>
    这种形式的表。