NPOI:如何在条件格式中使用自定义的XSSFColor?

我拥有的:

var sheetCf = sheet.SheetConditionalFormatting; var rule = sheetCf.CreateConditionalFormattingRule("A2>0"); var fill = rule.CreatePatternFormatting(); fill.FillBackgroundColor = IndexedColors.Red.Index; fill.FillPattern = (short)FillPattern.SolidForeground; 

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

你在找这个吗?

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