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

C# NPOI:如何在条件格式中使用自定义XSSFColor?,c#,excel,conditional-formatting,npoi,xssf,C#,Excel,Conditional Formatting,Npoi,Xssf,我所拥有的: var sheetCf = sheet.SheetConditionalFormatting; var rule = sheetCf.CreateConditionalFormattingRule("A2>0"); var fill = rule.CreatePatternFormatting(); fill.FillBackgroundColor = IndexedColors.Red.Index; fill.FillPattern = (short)FillPatter

我所拥有的:

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;