public static void ApplyAsiaCountriesConditionalFormatting(Worksheet sheet) { ConditionalFormattingCollection conditionalFormattings = sheet.ConditionalFormattings; FormulaExpressionConditionalFormatting cfRule = conditionalFormattings.AddFormulaExpressionConditionalFormatting(sheet["Table[Country]"], "=$B6=\"Asia\""); cfRule.Formatting.Fill.BackgroundColor = Color.FromArgb(255, 0xBC, 0xDA, 0xF7); }
public void ApplyNotExistsArticleFormatingforImportLog(Worksheet sheet, Range LogRange, Worksheet LogSheet) { try { string stRange = LogRange.GetReferenceA1(); ConditionalFormattingCollection conditionalFormattings = sheet.ConditionalFormattings; FormulaExpressionConditionalFormatting cfRule = conditionalFormattings.AddFormulaExpressionConditionalFormatting(sheet.GetDataRange(), "=$A1=VLOOKUP($A1,'Import des Logs'!$A:$A,1,0)"); cfRule.Formatting.Fill.BackgroundColor = Color.Red; } catch (Exception ex) { } }