Workbook book = new Workbook();
Worksheet sheet = book.Worksheets.Add("Sheet1");
AverageConditionalFormat avgFormat = sheet.ConditionalFormats.AddAverageCondition("A1:A10", FormatConditionAboveBelow.AboveAverage);
avgFormat.CellFormat.Font.ColorInfo = new WorkbookColorInfo(System.Drawing.Color.Red);
BlanksConditionalFormat blankFormat = sheet.ConditionalFormats.AddBlanksCondition("B1:B10");
blankFormat.CellFormat.Fill = CellFill.CreateSolidFill(System.Drawing.Color.Gray);
ColorScaleConditionalFormat colorFormat = sheet.ConditionalFormats.AddColorScaleCondition("C1:C10", ColorScaleType.ThreeColor);
colorFormat.MinimumThreshold.FormatColor = new WorkbookColorInfo(System.Drawing.Color.Green);
colorFormat.MidpointThreshold.FormatColor = new WorkbookColorInfo(System.Drawing.Color.Orange);
colorFormat.MaximumThreshold.FormatColor = new WorkbookColorInfo(System.Drawing.Color.Red);
DataBarConditionalFormat dataBarFormat = sheet.ConditionalFormats.AddDataBarCondition("D1:D10");
DateTimeConditionalFormat dateTimeFormat = sheet.ConditionalFormats.AddDateTimeCondition("E1:E10", FormatConditionTimePeriod.NextWeek);
dateTimeFormat.CellFormat.Font.ColorInfo = new WorkbookColorInfo(System.Drawing.Color.Blue);
DuplicateConditionalFormat duplicateFormat = sheet.ConditionalFormats.AddDuplicateCondition("F1:F10");
duplicateFormat.CellFormat.Font.ColorInfo = new WorkbookColorInfo(System.Drawing.Color.Magenta);
FormulaConditionalFormat formulaFormat = sheet.ConditionalFormats.AddFormulaCondition("H1:H10", "=H1>2");
formulaFormat.CellFormat.Font.ColorInfo = new WorkbookColorInfo(System.Drawing.Color.Blue);
IconSetConditionalFormat iconFormat = sheet.ConditionalFormats.AddIconSetCondition("I1:I10", FormatConditionIconSet.IconSet3Arrows);
NoBlanksConditionalFormat noBlanksFormat = sheet.ConditionalFormats.AddNoBlanksCondition("J1:J10");
noBlanksFormat.CellFormat.Fill = CellFill.CreateSolidFill(System.Drawing.Color.LightGray);
OperatorConditionalFormat operatorFormat = sheet.ConditionalFormats.AddOperatorCondition("L1:L10", FormatConditionOperator.Greater);
operatorFormat.SetOperand1(500);
operatorFormat.CellFormat.Font.ColorInfo = new WorkbookColorInfo(System.Drawing.Color.Red);
RankConditionalFormat rankFormat = sheet.ConditionalFormats.AddRankCondition("M1:M10", FormatConditionTopBottom.Top, 5);
rankFormat.CellFormat.Font.ColorInfo = new WorkbookColorInfo(System.Drawing.Color.Blue);
TextOperatorConditionalFormat textFormat = sheet.ConditionalFormats.AddTextCondition("N1:N10", "A", FormatConditionTextOperator.Contains);
textFormat.CellFormat.Font.ColorInfo = new WorkbookColorInfo(System.Drawing.Color.Magenta);
UniqueConditionalFormat uniqueFormat = sheet.ConditionalFormats.AddUniqueCondition("O1:O10");
uniqueFormat.CellFormat.Font.ColorInfo = new WorkbookColorInfo(System.Drawing.Color.Red);