码迷,mamicode.com
首页 > Web开发 > 详细

Aspose.Cells 设置背景颜色

时间:2016-06-07 14:47:17      阅读:2529      评论:0      收藏:0      [点我收藏+]

标签:

 很多小伙伴设置背景颜色都不起作用,特别提醒需要加入下面一行:

style.Pattern = BackgroundType.Solid;
Aspose.Cells.Style style = null;
int index = workbook.Styles.Add();
style = workbook.Styles[index];
//文本颜色
style.Font.Color = Color.Red;
style.Font.Size = 10;
//设置背景颜色
style.ForegroundColor = System.Drawing.Color.Silver;
style.Pattern = BackgroundType.Solid;
style.Font.IsBold = true;
style.HorizontalAlignment = Aspose.Cells.TextAlignmentType.Center;
style.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thin; //应用边界线 左边界线 
style.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thin; //应用边界线 右边界线 
style.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thin; //应用边界线 上边界线 
style.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin; //应用边界线 下边界线
Aspose.Cells.Range w = cells.CreateRange(row, col, 1, 1);
w.ApplyStyle(style, new StyleFlag() { All=true});

 

Aspose.Cells 设置背景颜色

标签:

原文地址:http://www.cnblogs.com/shenyixin/p/5566822.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!