我有什么:
var sheetCf = sheet.SheetConditionalFormatting;
var rule = sheetCf.CreateConditionalFormattingRule("A2>0");
var fill = rule.CreatePatternFormatting();
fill.FillBackgroundColor = IndexedColors.Red.Index;
fill.FillPattern = (short)FillPattern.SolidForeground;
如何为背景设置自定义颜色?
答案 0 :(得分:0)
你在找这个吗?
XSSFCellStyle myCellStyle = (XSSFCellStyle)workbook.CreateCellStyle();
myCellStyle.FillBackgroundColor = IndexedColors.LightYellow.Index;
myCellStyle.FillPattern = FillPattern.NoFill;
myCellStyle.FillForegroundColor = IndexedColors.LightTurquoise.Index;