码迷,mamicode.com
首页 > 其他好文 > 详细

daochu

时间:2017-11-22 13:01:50      阅读:199      评论:0      收藏:0      [点我收藏+]

标签:ring   nbsp   return   oda   get   app   var   stream   turn   

 public ActionResult daochu()
        {
            HSSFWorkbook book = new HSSFWorkbook();
            ISheet sheet = book.CreateSheet("sheet1");
            IRow rows = sheet.CreateRow(0);
            rows.CreateCell(0).SetCellValue("编号");
            rows.CreateCell(1).SetCellValue("姓名");
            rows.CreateCell(2).SetCellValue("类");
     
            var data = new BLL.sBLL().getss();
            for (int i = 0; i < data.Rows.Count; i++)
            {
                IRow row1 = sheet.CreateRow(i+1);
                row1.CreateCell(0).SetCellValue(data.Rows[i]["ID"].ToString());
                row1.CreateCell(1).SetCellValue(data.Rows[i]["Name"].ToString());
                row1.CreateCell(2).SetCellValue(data.Rows[i]["AradeNo"].ToString());
            
            }
            MemoryStream sm = new MemoryStream();
            book.Write(sm);
            sm.Seek(0,SeekOrigin.Begin);
            return File(sm,"application/ved-excel","biaodan.xls");
        }

daochu

标签:ring   nbsp   return   oda   get   app   var   stream   turn   

原文地址:http://www.cnblogs.com/jin68/p/7878508.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!