标签: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");
}
标签:ring nbsp return oda get app var stream turn
原文地址:http://www.cnblogs.com/jin68/p/7878508.html