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(); }