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();
            }
  • 相关阅读:
    对数值计算numpy的一些总结,感兴趣的朋友可以看看
    mysql基础语法(部分)
    python_内建结构
    07_go语言基础
    06_go语言基础
    05_go语言基础常量
    04_go语言基础
    03_go语言基础
    02_go语言基础
    01_go语言基础
  • 原文地址:https://www.cnblogs.com/liandy0906/p/8302316.html
Copyright © 2011-2022 走看看