【问题标题】:NPOI: how to use custom XSSFColor in conditional formatting?NPOI:如何在条件格式中使用自定义 XSSFColor?
【发布时间】:2015-02-01 13:14:04
【问题描述】:

我有什么:

var sheetCf = sheet.SheetConditionalFormatting;
var rule = sheetCf.CreateConditionalFormattingRule("A2>0");
var fill = rule.CreatePatternFormatting();

fill.FillBackgroundColor = IndexedColors.Red.Index;
fill.FillPattern = (short)FillPattern.SolidForeground;

如何为背景设置自定义颜色?

【问题讨论】:

    标签: c# excel conditional-formatting npoi xssf


    【解决方案1】:

    你在找这个吗

    XSSFCellStyle myCellStyle = (XSSFCellStyle)workbook.CreateCellStyle();
    myCellStyle.FillBackgroundColor = IndexedColors.LightYellow.Index;
    myCellStyle.FillPattern = FillPattern.NoFill;
    myCellStyle.FillForegroundColor = IndexedColors.LightTurquoise.Index;
    

    【讨论】:

      猜你喜欢
      • 2015-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-24
      • 1970-01-01
      • 1970-01-01
      • 2014-12-28
      • 1970-01-01
      相关资源
      最近更新 更多