日期:2014-05-17  浏览次数:20460 次

导出EXCLE问题
<meta http-equiv="content-type" content="application/ms-excel; charset=GB2312"/>
<table border="0">
<tr style="background-color:#CEDFEF;">
<td style="width:80px;height:25px; text-align:center; font-weight:bold; border:solid 0.5pt black">序号</td><td style="width:80px;height:25px; text-align:center; font-weight:bold; border:solid 0.5pt black">日期</td><td style="width:80px;height:25px; text-align:center; font-weight:bold; border:solid 0.5pt black">机构名称</td><td style="width:80px;height:25px; text-align:center; font-weight:bold; border:solid 0.5pt black">经纪人</td><td style="width:150px;height:25px; text-align:center; font-weight:bold; border:solid 0.5pt black">物业地址</td><td style="width:80px;height:25px; text-align:center; font-weight:bold; border:solid 0.5pt black">建成年代</td><td style="width:80px;height:25px; text-align:center; font-weight:bold; border:solid 0.5pt black">面积</td><td style="width:80px;height:25px; text-align:center; font-weight:bold; border:solid 0.5pt black">楼层</td><td style="width:80px;height:25px; text-align:center; font-weight:bold; border:solid 0.5pt black">朝向</td><td style="width:100px;height:25px; text-align:center; font-weight:bold; border:solid 0.5pt black">初评价格</td><td style="width:100px;height:25px; text-align:center; font-weight:bold; border:solid 0.5pt black">登记用户</td>
</tr><tr>
<td style="height:20px;text-align:center;border:solid 0.5pt black; ">380978</td><td style="height:20px;text-align:center;border:solid 0.5pt black; ">2013-3-19 11:27:17</td><td style="height:20px;text-align:center;border:solid 0.5pt black; ">链家</td><td style="height:20px;text-align:center;border:solid 0.5pt black; "></td><td style="height:20px;text-align:center;border:solid 0.5pt black; ">金尚嘉园</td><td style="height:20px;text-align:center;border:solid 0.5pt black; "></td><td style="height:20px;text-align:center;border:solid 0.5pt black; ">76.5</td><td style="height:20px;text-align:center;border:solid 0.5pt black; ">9/</td><td style="height:20px;text-align:center;border:solid 0.5pt black; ">东</td><td style="height:20px;text-align:center;border:solid 0.5pt black; ">48560贷260/7</td><td style="height:20px;text-align:center;border:solid 0.5pt black; ">罗永</td>
</tr>
</table>


文件流输出的是以上字符串,但是没有下载提示!
代码:
  HtmlTextWriter hw = new HtmlTextWriter(tw);
            this.EnableViewState = false;
            hw.WriteLine("<meta http-equiv=\"content-type\" content=\"application/ms-excel; charset=GB2312\"/>");
            table.RenderControl(hw);
            Response.AppendHeader("Content-Disposition", "Attachment;Filename=" + HttpUtility.UrlEncode("Attendance.xls", System.Text.Encoding.Default));
        &