转载

[Repeater]导出为excel格式

铁观音-厂家直销

      StringWriter sw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(sw);
        this.rptSaleOrder.RenderControl(hw);

        Response.Clear();
        Response.ContentType = "application/vnd.ms-excel";
        Response.Charset = "";
        rptSaleOrder.Page.EnableViewState = true;
        Response.AppendHeader("Content-Disposition", "attachment;filename=\"" + HttpUtility.UrlEncode("月销售单(" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss") + ").xls", System.Text.Encoding.UTF8) + "\"");
        Response.Write("<html><head><meta http-equiv=Content-Type content=\"text/html; charset=UTF8\"><title> adsf</title></head><body><table><tr><td> 时间</td><td>订单号</td><td>商品</td><td>数量</td><td>单价</td><td>运费</td><td>金额</td><td>付款方式</td><td>发票</td><td>备注</td></tr>");
        Response.Write(sw.ToString());
        Response.Write("</table></body></html>");
        Response.End();


文章最后发布于: 2010-03-25 09:06:00
展开阅读全文
0 个人打赏
私信求帮助

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 鲸 设计师: meimeiellie

分享到微信朋友圈

×

扫一扫,手机浏览