diff --git a/ClosedXML_Examples/ConditionalFormatting/ConditionalFormatting.cs b/ClosedXML_Examples/ConditionalFormatting/ConditionalFormatting.cs index efd53e8..5adc52f 100644 --- a/ClosedXML_Examples/ConditionalFormatting/ConditionalFormatting.cs +++ b/ClosedXML_Examples/ConditionalFormatting/ConditionalFormatting.cs @@ -18,7 +18,7 @@ ws.RangeUsed().AddConditionalFormat().ColorScale() .LowestValue(XLColor.Red) - .Midpoint(XLCFContentType.Percent, "50", XLColor.Yellow) + .Midpoint(XLCFContentType.Percent, "50", XLColor.Yellow) .HighestValue(XLColor.Green); workbook.SaveAs(filePath); @@ -46,6 +46,26 @@ } } + public class CFColorScaleMinimumMaximum : IXLExample + { + public void Create(String filePath) + { + var workbook = new XLWorkbook(); + var ws = workbook.AddWorksheet("Sheet1"); + + ws.FirstCell().SetValue(1) + .CellBelow().SetValue(1) + .CellBelow().SetValue(2) + .CellBelow().SetValue(3); + + ws.RangeUsed().AddConditionalFormat().ColorScale() + .LowestValue(XLColor.FromHtml("#FFFF7128")) + .HighestValue(XLColor.FromHtml("#FFFFEF9C")); + + workbook.SaveAs(filePath); + } + } + public class CFStartsWith : IXLExample { public void Create(String filePath) @@ -567,7 +587,7 @@ var range = ws.RangeUsed(); range.AddConditionalFormat().WhenEquals("1").Font.SetBold(); range.InsertRowsAbove(1); - + workbook.SaveAs(filePath); } @@ -589,7 +609,7 @@ ws.RangeUsed().AddConditionalFormat().DataBar(XLColor.Red) .LowestValue() .HighestValue(); - + workbook.SaveAs(filePath); } } diff --git a/ClosedXML_Tests/ClosedXML_Tests.csproj b/ClosedXML_Tests/ClosedXML_Tests.csproj index 5ea0151..57835a2 100644 --- a/ClosedXML_Tests/ClosedXML_Tests.csproj +++ b/ClosedXML_Tests/ClosedXML_Tests.csproj @@ -229,6 +229,7 @@ + @@ -245,11 +246,11 @@ - + @@ -260,4 +261,4 @@ --> - + \ No newline at end of file diff --git a/ClosedXML_Tests/Examples/ConditionalFormattingTests.cs b/ClosedXML_Tests/Examples/ConditionalFormattingTests.cs index 823ebeb..1ab8fe2 100644 --- a/ClosedXML_Tests/Examples/ConditionalFormattingTests.cs +++ b/ClosedXML_Tests/Examples/ConditionalFormattingTests.cs @@ -19,6 +19,12 @@ } [Test] + public void CFColorScaleMinimumMaximum() + { + TestHelper.RunTestExample(@"ConditionalFormatting\CFColorScaleMinimumMaximum.xlsx"); + } + + [Test] public void CFContains() { TestHelper.RunTestExample(@"ConditionalFormatting\CFContains.xlsx"); @@ -107,23 +113,5 @@ { TestHelper.RunTestExample(@"ConditionalFormatting\CFMultipleConditions.xlsx"); } - - //[Test] - //public void XXX() - //{ - // TestHelper.RunTestExample(@"ConditionalFormatting\XXX.xlsx"); - //} - // - //[Test] - //public void XXX() - //{ - // TestHelper.RunTestExample(@"ConditionalFormatting\XXX.xlsx"); - //} - // - //[Test] - //public void XXX() - //{ - // TestHelper.RunTestExample(@"ConditionalFormatting\XXX.xlsx"); - //} } -} \ No newline at end of file +} diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleLowMidHigh.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleLowMidHigh.xlsx index 640d65d..9bc4eb6 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleLowMidHigh.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleLowMidHigh.xlsx Binary files differ diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleMinimumMaximum.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleMinimumMaximum.xlsx new file mode 100644 index 0000000..ef35d8b --- /dev/null +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFColorScaleMinimumMaximum.xlsx Binary files differ