zoukankan      html  css  js  c++  java
  • web页导出excel

            public void ExportExcelBrand()
            {
                string elxStr = "";
                string body = "";
                List<BrandRemindTB> list = this.BaseService.GetModelList<BrandRemindTB>(u => u.MemberID == this.MemberContext.MemberTB.ID);
    
                foreach (var item in list)
                {
                    body += "<tr><td>" + item.Type + "</td><td>" + item.Number + "</td><td>" + item.BrandName + "</td><td>" + item.AppName + "</td><td>" + item.AppDate.ToString("yyyy-MM-dd") + "</td><td>" + (item.EndDate == null ? "" : ((DateTime)item.EndDate).ToString("yyyy-MM-dd")) + "</td><td>" + item.Status + "</td></tr>";
                }
    
                elxStr += "<table>" +
                                "<th><tr><td>类型</td><td>注册号</td><td>商标名称</td><td>申请人</td><td>申请日期</td><td>到期日期</td><td>状态</td></tr></th>" +
                                "<tbody>" +
                                body +
                                "</tbody>" +
                           "</table>";
    
                Response.Clear();
                Response.Buffer = true;
                Response.AppendHeader("Content-Disposition", "attachment;filename=" + IDGenerator.DateTimeAndNumber() + ".xls");
                Response.ContentEncoding = System.Text.Encoding.UTF8;
                Response.ContentType = "application/vnd.ms-excel";
                Response.Write(elxStr);
                Response.End();
            }
  • 相关阅读:
    获取系统版本
    一句代码删除所有子视图
    MAJOR-MINOR-MKDEV
    AF_UNIX和AF_INET域的socket在epoll中的差异
    python-print
    python-class(5)
    python-class(4)
    python-class(3)
    python-class(2)
    python-class(1)
  • 原文地址:https://www.cnblogs.com/liandy0906/p/8302316.html
Copyright © 2011-2022 走看看