WIP: Sorting cells having formulas (#105) #1565
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a work in progress
✔️ The issue nr. 1. Sorting algorithm swaps cells leaving their A1-style formulas unchanged.
✔️ The issue nr. 2. Cells with formulas are compared by
InnerText
which is nonsense. As a consequence, formulaA10+B10
goes beforeA2+B2
no matter what are the results of those formulas.🟥 The issue nr. 3. When two cells are compared, ClosedXML analyzes their
DataType
and if they both haveText
they are compared as text, and 2 considered larger than 10.I think we should implement a comparer that will handle different combinations of data types, blanks, formulas, etc. But right now I don't have enough time. Will try to get back to this sometime later.
Fixes #105