-
Notifications
You must be signed in to change notification settings - Fork 297
Conditional Formatting ‐ Databars
Databars when edited in Excel have the following options:
Type,
Value
Fill type,
FillColor
BorderType,
BorderColor
Bar-Direction
In Epplus Databars need to specify a color when created, like so:
var bar = sheet.ConditionalFormatting.AddDatabar(new ExcelAddress("A1:A12"), Color.DarkRed);
In addition a variety of options are accessable via the HighValue and LowValue Properties. The value.Type property set by the eExcelConditionalFormattingValueObjectType enum. Represents the Type fields in the image above and can be set e.g. like this:
var cfRule = worksheet.ConditionalFormatting.AddDatabar(cfAddress44, Color.DarkBlue);
cfRule.HighValue.Type = eExcelConditionalFormattingValueObjectType.Percent;
cfRule.LowValue.Type = eExcelConditionalFormattingValueObjectType.Percentile;Similarily Value and Formula can be set in the value field using those properties.
The color of the dataBar can also be changed after creation e.g. like this:
cfRule.Color = Color.DarkRed
As of Epplus 7.0 full-support for Databars was added and the following properties can now be changed directly from Epplus using the HighValue or LowValue Properties:
- Gradient
- Border
- NegativeBarColorSameAsPositive
- NegativeBarBorderColorSameAsPositive
- AxisPosition
- FillColor
- BorderColor
- NegativeFillColor
- NegativeBorderColor
- AxisColor
Which encompases all options in the image above and Advanced Settings In addition all color properties can be set to Auto, Index or Theme color instead of only e.g. Color.X
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
- Breaking Changes in EPPlus 8
- 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
- Hyperlinks
- Autofit columns
- Grouping and Ungrouping Rows and Columns
- Formatting and styling
- The ExcelRange.Text property
- Conditional formatting
- Using Themes
- Working with custom named table- or slicer- styles