ClosedXML / ClosedXML/ClosedXML
Issue with sort when using ignore blanks set to false.
- Dominant language
- C#
- Stars
- 5.7k
- Forks
- 933
- Avg merge
- 12h 14m
- Merged PRs (30d)
- 1
Description
## Read and complete the full issue template
Do not randomly delete sections. They are here for a reason.
**Do you want to request a *feature* or report a *bug*?**
- [x] Bug
- [ ] Feature
- [ ] Question
**Did you test against the latest CI build?**
- [ X] Yes
- [ ] No
If you answered `No`, please test with [the latest development build](https://ci.appveyor.com/project/ClosedXML/ClosedXML/branch/develop/artifacts) first.
**Version of ClosedXML**
0.101.0
e.g. 0.95.3
**What is the current behavior?**
Complete this.
When doing a sort of an excel file and using overload 7 of the range.SortColumns.Add with ignore blanks set to false and ignore case set to true we get a "System.NotImplementedException". If we change to ignore blanks to true and ignore case to true the sort works.
**What is the expected behavior or new feature?**
Complete this. The Sort should still work with ignore blanks set to false.
**Is this a regression from the previous version?** Yes, This worked in Version 0.95.4
Regressions get higher priority. Test against the latest build of the previous minor version. For example, if you experience a problem on v0.95.3, check whether it the problem occurred in v0.94.2 too.
## 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()
{
// 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)
// - The code should be a minimal code sample to illustrate issue. The code
// samples on the wiki are good examples of the terseness that I want. Don't
// post your full application.
}
```
ClosedXML.Excel.XLWorkbook workbook;
try
{
String filename = "C:\\Data\\ResearchForApplications\\Sample.xlsx";
workbook = new ClosedXML.Excel.XLWorkbook(filename);
ClosedXML.Excel.IXLWorksheet Sheet1 = workbook.Worksheets.First();
ClosedXML.Excel.IXLRange rangeUsed = Sheet1.RangeUsed();
String usedRange = rangeUsed.RangeAddress.ToString();
int Length = usedRange.Length;
String updateRange = "A2" + StrUtils.Mid(usedRange, 2, Length - 2);
ClosedXML.Excel.IXLRange range = Sheet1.Range(updateRange);
range.SortColumns.Add(10, XLSortOrder.Descending,false,true);
range.Sort();
workbook.Save();
workbook.Dispose();
}
catch (Exception ex)
{
MessageBox.Show("Problem with the sort" + ex.ToString());
}
- [ ] I attached a sample spreadsheet. (You can drag files on to this issue)
[Sample.xlsx](https://github.com/ClosedXML/ClosedXML/files/11615171/Sample.xlsx)
Contributor guide
Research direction
Start by reproducing the call to range.SortColumns.Add(10, XLSortOrder.Descending, false, true) followed by range.Sort() from the issue, using the attached Sample.xlsx. Trace the sorting path that handles ignore blanks and ignore case, then confirm that the same input completes without System.NotImplementedException and produces the expected descending sort.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100