首页 > Web开发 > 详细

asp.net借助Aspose.Cells组件导出excel文件

时间:2016-01-18 11:38:06      阅读:549      评论:0      收藏:0      [点我收藏+]

Aspose.Cells是一个广受赞誉的电子表格组件,支持所有Excel格式类型的操作,用户无需依靠Microsoft Excel也可为其应用程序嵌入读写和处理Excel数据表格的功能。Aspose.Cells可以导入和导出每一个具体的数据,表格和格式,在各个层面导入图像,应用复杂的计算公式,并将Excel的数据保存为各种格式等等---完成所有的这一切功能都无需使用Microsoft Excel 和Microsoft Office Automation。

实例

Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
sheet.Cells[0, 0].Value = "编码";
sheet.Cells[0, 1].Value = "名称";

int index = 1;
for(int i=0;i<10;i++)
{
    sheet.Cells[index, 0].Value = i;
    sheet.Cells[index, 1].Value = "名称";
    index++;
}

Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition",
    string.Format("attachment;filename=excel.xls"));
workbook.Save(Response.OutputStream, SaveFormat.Excel97To2003);
Response.Flush();

asp.net借助Aspose.Cells组件导出excel文件

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!