Skip to content

Conditional Formatting ‐ Custom Iconsets

OssianEPPlus edited this page Sep 18, 2023 · 14 revisions
$$\color{#ff4545}\textsf{\Largeⓘ\kern{0.2cm}\normalsize Below only available from Epplus 7.0 onwards}$$

As of Epplus 7.0 you can create CustomIconSets with EPPlus

To do so, try e.g.

 using (var pck = new ExcelPackage())
{
     var threeIcon = wks.ConditionalFormatting.AddThreeIconSet(new ExcelAddress("A1:A20"), eExcelconditionalFormatting3IconsSetType.Triangles);

     threeIcon.Icon1.CustomIcon = eExcelconditionalFormattingCustomIcon.RedFlag;
     threeIcon.Icon2.CustomIcon = eExcelconditionalFormattingCustomIcon.NoIcon;
     threeIcon.Icon3.CustomIcon = eExcelconditionalFormattingCustomIcon.GrayDownInclineArrow;
}

This is also available with FourIcon and FiveIcon sets. The OfficeOpenXml.ConditionalFormatting.eExcelconditionalFormattingCustomIcon enum includes an option for all icons available in Excel. Note that Icons in excel are counted from the bottom up when editing a rule. So Icon1 will be lowest when looking in settings. Unless you apply reverse icon order

Results:

image

image

EPPlus wiki

Versions

Worksheet & Ranges

Styling

Import/Export data

Formulas and filters

Charts & Drawing objects

Tables & Pivot Tables

VBA & Protection

Clone this wiki locally