-
Notifications
You must be signed in to change notification settings - Fork 284
Three color scale example
Mats Alm edited this page Oct 26, 2023
·
5 revisions
Here is a Conditional Formatting example where we add a ThreeColorScale rule. Let's start with how the result will look like:
Here is how this rule will look like when edited in Excel:
And here is the code to achieve it with EPPlus:
// Add TwoColorScale conditional formatting to visualize temperatures
// ColorTranslator is a utility from System.Drawing.Primitives.
var cfRule = sheet.ConditionalFormatting.AddThreeColorScale(sheet.Cells["B2:G11"]);
cfRule.LowValue.Color = ColorTranslator.FromHtml("#FF63BE7B");
cfRule.MiddleValue.Color = ColorTranslator.FromHtml("#FFFFEB84");
cfRule.MiddleValue.Type = eExcelConditionalFormattingValueObjectType.Percentile;
cfRule.MiddleValue.Value = 50;
cfRule.HighValue.Color = ColorTranslator.FromHtml("#FFF8696B");
EPPlus Software AB - https://epplussoftware.com
- What is new in EPPlus 5+
- Breaking Changes in EPPlus 5
- Breaking Changes in EPPlus 6
- Breaking Changes in EPPlus 7
- Addressing a worksheet
- Dimension/Used range
- Copying ranges/sheets
- Insert/Delete
- Filling ranges
- Sorting ranges
- Taking and skipping columns/rows
- Data validation
- Comments
- Freeze and Split Panes
- Header and Footer
- Autofit columns
- Grouping and Ungrouping Rows and Columns
- Formatting and styling
- Conditional formatting
- Using Themes
- Working with custom named table- or slicer- styles