diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 984600d..5b1b779 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,3 +1,5 @@ +## Read and complete the full issue template + **Do you want to request a *feature* or report a *bug*?** - [x] Bug - [ ] Feature @@ -8,20 +10,26 @@ **What is the current behavior?** -**If the current behavior is a bug, please provide the steps to reproduce and -if possible a minimal demo of the problem with a sample spreadsheet.** +Complete this. **What is the expected behavior or new feature?** +Complete this. + **Did this work in previous versions of our tool? Which versions?** -- [ ] I attached a sample spreadsheet. (You can drag files on to this issue) +Yes/No/v0.XX + +## Reproducibility +**This is an important section. Read it carefully. Failure to do so will cause a 'RTFM' comment.** + +Without a code sample, it is unlikely that your issue will get attention. Don't be lazy. Do the effort and assist the developers to reproduce your problem. Code samples should be [minimal complete and verifiable](https://stackoverflow.com/help/mcve). Sample spreadsheets should be attached whenever applicable. Remove sensitive information. **Code to reproduce problem:** ```c# public void Main() { - // Where possible, post full code to reproduce your issue that adheres to: + // Code standards: // - Fully runnable. I should be able to copy and paste this code into a // console application and run it without having to edit it much. // - Declare all your variables (this follows from the previous point) @@ -30,3 +38,4 @@ // post your full application. } ``` +- [ ] I attached a sample spreadsheet. (You can drag files on to this issue) diff --git a/ClosedXML/Excel/ConditionalFormats/IXLConditionalFormat.cs b/ClosedXML/Excel/ConditionalFormats/IXLConditionalFormat.cs index b5b3b24..ce97e2a 100644 --- a/ClosedXML/Excel/ConditionalFormats/IXLConditionalFormat.cs +++ b/ClosedXML/Excel/ConditionalFormats/IXLConditionalFormat.cs @@ -100,7 +100,7 @@ IXLCFColorScaleMin ColorScale(); IXLCFDataBarMin DataBar(XLColor color, Boolean showBarOnly = false); - IXLCFDataBarMin DataBar(XLColor color, XLColor colorNegative, Boolean showBarOnly = false); + IXLCFDataBarMin DataBar(XLColor positiveColor, XLColor negativeColor, Boolean showBarOnly = false); IXLCFIconSet IconSet(XLIconSetStyle iconSetStyle, Boolean reverseIconOrder = false, Boolean showIconOnly = false); XLConditionalFormatType ConditionalFormatType { get; } @@ -123,4 +123,3 @@ } } - \ No newline at end of file diff --git a/ClosedXML/Excel/ConditionalFormats/XLConditionalFormat.cs b/ClosedXML/Excel/ConditionalFormats/XLConditionalFormat.cs index e318a5b..a408063 100644 --- a/ClosedXML/Excel/ConditionalFormats/XLConditionalFormat.cs +++ b/ClosedXML/Excel/ConditionalFormats/XLConditionalFormat.cs @@ -344,10 +344,10 @@ ConditionalFormatType = XLConditionalFormatType.DataBar; return new XLCFDataBarMin(this); } - public IXLCFDataBarMin DataBar(XLColor color, XLColor colorNegative, Boolean showBarOnly = false) + public IXLCFDataBarMin DataBar(XLColor positiveColor, XLColor negativeColor, Boolean showBarOnly = false) { - Colors.Initialize(color); - Colors.Add(colorNegative); + Colors.Initialize(positiveColor); + Colors.Add(negativeColor); ShowBarOnly = showBarOnly; ConditionalFormatType = XLConditionalFormatType.DataBar; return new XLCFDataBarMin(this); diff --git a/ClosedXML/Excel/ConditionalFormats/XLConditionalFormats.cs b/ClosedXML/Excel/ConditionalFormats/XLConditionalFormats.cs index 104dcb7..dc00b56 100644 --- a/ClosedXML/Excel/ConditionalFormats/XLConditionalFormats.cs +++ b/ClosedXML/Excel/ConditionalFormats/XLConditionalFormats.cs @@ -10,11 +10,6 @@ private readonly List _conditionalFormats = new List(); public void Add(IXLConditionalFormat conditionalFormat) { - byte[] bytes = new byte[16]; - BitConverter.GetBytes(_conditionalFormats.Count + 1).CopyTo(bytes, 0); - var guid = new Guid(bytes); - conditionalFormat.Name = string.Concat("{", guid.ToString(), "}"); - _conditionalFormats.Add(conditionalFormat); } diff --git a/ClosedXML_Examples/ConditionalFormatting/ConditionalFormatting.cs b/ClosedXML_Examples/ConditionalFormatting/ConditionalFormatting.cs index b14e339..c8bc883 100644 --- a/ClosedXML_Examples/ConditionalFormatting/ConditionalFormatting.cs +++ b/ClosedXML_Examples/ConditionalFormatting/ConditionalFormatting.cs @@ -534,12 +534,18 @@ var workbook = new XLWorkbook(); var ws = workbook.AddWorksheet("Sheet1"); - ws.FirstCell().SetValue(1) + ws.FirstCell().SetValue(-1) .CellBelow().SetValue(1) .CellBelow().SetValue(2) .CellBelow().SetValue(3); - ws.RangeUsed().AddConditionalFormat().DataBar(XLColor.Green, XLColor.Red, false) + byte[] bytes = new byte[16]; + BitConverter.GetBytes(1).CopyTo(bytes, 0); + var guid = new Guid(bytes); + + var conditionalFormat = ws.RangeUsed().AddConditionalFormat(); + conditionalFormat.Name = string.Concat("{", guid.ToString(), "}"); + conditionalFormat.DataBar(XLColor.Green, XLColor.Red, false) .LowestValue() .Maximum(XLCFContentType.Percent, "100"); diff --git a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFDataBarNegative.xlsx b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFDataBarNegative.xlsx index b743aaf..a3f79f6 100644 --- a/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFDataBarNegative.xlsx +++ b/ClosedXML_Tests/Resource/Examples/ConditionalFormatting/CFDataBarNegative.xlsx Binary files differ