这两天用Aspose.Cells构建一个Excel报表,感觉这个组件还比较好用.记录一下常用的使用知识:
1.创建Workbook和Worksheet
![](http://writeblog.csdn.net/Images/OutliningIndicators/ExpandedBlockStart.gif)
Workbook wb = new Workbook();
wb.Worksheets.Clear();
wb.Worksheets.Add("New Worksheet1");//New Worksheet1是Worksheet的name
Worksheet ws = wb.Worksheets[0];
如果直接用下边两句则直接使用默认的第一个Worksheet:
![](http://writeblog.csdn.net/Images/OutliningIndicators/ExpandedBlockStart.gif)
Workbook wb = new Workbook();
Worksheet ws = wb.Worksheets[0];
2.给Cell赋值设置背景颜色并加背景色:
![](http://writeblog.csdn.net/Images/OutliningIndicators/ExpandedBlockStart.gif)
Cell cell = ws.Cells[0, 0];
cell.PutValue("填充"); //必须用PutValue方法赋值
cell.Style.ForegroundColor = Color.Yellow;
cell.Style.Pattern = BackgroundType.Solid;
cell.Style.Font.Size =