var book = new HSSFWorkbook();
var sheet = book.CreateSheet("学生信息表");
string[] headcell = { "学号", "姓名", "年龄", "性别" };
var row0 = sheet.CreateRow(0);
for (int i = 0; i < headcell.Length; i++)
{
var cell = row0.CreateCell(i);
cell.SetCellValue(new HSSFRichTextString(headcell[i]));
}
using (var ms = new MemoryStream())
{
book.Write(ms);
Response.Clear();
Response.ClearHeaders();
Response.AddHeader("content-disposition", "attachment; filename=1.xls");
Response.Buffer = true;
Response.ContentType = "application/ms-excel";
Response.BinaryWrite(ms.ToArray());
}
相关文章
- 07-14jira7.3.6添加导出excel的按钮
- 07-14POI导出EXCEL文档,表格水平垂直居中、表头添加颜色等常用属性方法
- 07-14Winforn中通过NPOI导出Excel时通过XSSFClientAnchor和XSSFPicture添加图片
- 07-14c#中数据从数据库到客户端主要几种的导出方式(导出到excel,导出到word)
- 07-14C#将数据库导出成Excel,再从Excel导入到数据库中。
- 07-14Winforn中通过NPOI导出Excel时通过XSSFClientAnchor和XSSFPicture添加图片
- 07-14C#将数据集DataSet中的数据导出到EXCEL文件的几种方法
- 07-14C# 将SQLSERVER的表导出为EXCEL
- 07-14C#中导出EXCEL服务器端不用安装OFFICE
- 07-14C#应用NPOI实现导出EXcel表格中插入饼状图(可实现动态数据生成)