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();