2015-02-01 2 views
1

Что у меня есть: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; 

Как я могу установить пользовательские цвета для фона?

ответ

0

Вы ищете для этого

XSSFCellStyle myCellStyle = (XSSFCellStyle)workbook.CreateCellStyle(); 
myCellStyle.FillBackgroundColor = IndexedColors.LightYellow.Index; 
myCellStyle.FillPattern = FillPattern.NoFill; 
myCellStyle.FillForegroundColor = IndexedColors.LightTurquoise.Index; 
Смежные вопросы