zoukankan      html  css  js  c++  java
  • Aspose.Cells 设置背景颜色

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

    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});
  • 相关阅读:
    HTML5中meta属性的使用详解
    前端部分兼容性问题汇总
    position元素定位详述
    jquery简单实现轮播图
    事件委托-选项卡案例
    async、await
    前端会遇到的算法
    arguments实参个数
    前端知识点整理(三)
    var、let、const
  • 原文地址:https://www.cnblogs.com/shenyixin/p/5566822.html
Copyright © 2011-2022 走看看