标签:行号 country val div cell birt ati 数组 card
var list = vM_VolunteerBLL.GetVM_VolunteerList(where); IWorkbook work =new XSSFWorkbook(); ISheet sheet = work.CreateSheet("志愿者信息表"); IRow row = sheet.CreateRow(0); row.CreateCell(0).SetCellValue("行号"); row.CreateCell(1).SetCellValue("姓名"); row.CreateCell(2).SetCellValue("性别"); row.CreateCell(3).SetCellValue("出生日期"); row.CreateCell(4).SetCellValue("身份证"); row.CreateCell(5).SetCellValue("护照"); row.CreateCell(6).SetCellValue("手机"); row.CreateCell(7).SetCellValue("邮箱"); row.CreateCell(8).SetCellValue("国籍"); row.CreateCell(9).SetCellValue("城市"); row.CreateCell(10).SetCellValue("比赛名称"); row.CreateCell(11).SetCellValue("比赛时间"); row.CreateCell(12).SetCellValue("工作类型"); row.CreateCell(13).SetCellValue("工作内容"); row.CreateCell(14).SetCellValue("创建人"); row.CreateCell(15).SetCellValue("创建时间"); for (var i = 0; i < list.Count; i++) { row = sheet.CreateRow(i + 1); row.CreateCell(0).SetCellValue(i + 1); row.CreateCell(1).SetCellValue(list[i].Name); row.CreateCell(2).SetCellValue(list[i].Sex==1?"男":"女"); row.CreateCell(3).SetCellValue(list[i].Birthday.ToString("yyyy-MM-dd")); row.CreateCell(4).SetCellValue(list[i].IDCard); row.CreateCell(5).SetCellValue(list[i].Protection); row.CreateCell(6).SetCellValue(list[i].Phone); row.CreateCell(7).SetCellValue(list[i].EMail); row.CreateCell(8).SetCellValue(list[i].Country); row.CreateCell(9).SetCellValue(list[i].City); row.CreateCell(10).SetCellValue(list[i].GameName); row.CreateCell(11).SetCellValue(list[i].GameDate.ToString("yyyy-MM-dd")); row.CreateCell(12).SetCellValue(list[i].VolunteerTypeName); row.CreateCell(13).SetCellValue(list[i].WorkContext); row.CreateCell(14).SetCellValue(list[i].CreateName); row.CreateCell(15).SetCellValue(list[i].CreateDate.ToString("yyyy-MM-dd")); } //声明空的byte数组 byte[] buffer = new byte[0]; //创建缓存流 using (MemoryStream ms = new MemoryStream()) { //将work写入缓存流 work.Write(ms); buffer = ms.GetBuffer(); } //返回byte数组 return File(buffer, "application/ms-excel", "志愿者信息.xlsx");
标签:行号 country val div cell birt ati 数组 card
原文地址:https://www.cnblogs.com/JueXiaoQiang/p/10577830.html