Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use types values in a cell. #1922

Merged
merged 1 commit into from
Dec 11, 2022
Merged

Use types values in a cell. #1922

merged 1 commit into from
Dec 11, 2022

Conversation

jahav
Copy link
Member

@jahav jahav commented Nov 29, 2022

A PR so I can work easily review and start to clean up and improve my dev branch (which is an incomplete mess).

Test files:

  • I have removed a type from test case files where
    • cell didn't have a value (e.g. <c r="A1" t ="s"/> without a value) - that value is a blank, specifying type without value doesn't do anything and I represent a missing value is a blank type anyway.
    • where the type is redundant (i.e. if value is a number, the t="n" is redundant).
  • DataType test was trimmed because DataType can't be changed anymore
  • DataTypeUnderDifferentCulture was removed because it didn't do anything - conversion is no longer handler in the cell.

Will resolve #1894 when done and merged.

@jahav jahav added this to the v0.97.1 milestone Nov 29, 2022
@jahav jahav changed the title WIP: Use types values in a cell. Use types values in a cell. Dec 11, 2022
@jahav jahav marked this pull request as ready for review December 11, 2022 22:48
…ype of IXLCell.Value from Object to XLCellValue. This provides a better semantic, so users know exactly what values are allowed in a cell and replaces "guessing" of string values for some edge cases.

The new cell value type is XLCellValue (public readonly struct to avoid boxing/unboxing). Adjust API where necessary (see migration doc).

Key benefits:
 * The value is now typed and it is far easier to do operations on it (e.g. sorting, comparison....)
 * Streamline the behavior and decrease amount of unexpected results.
 * Value is no longer guessed

Due to inconsistencies in writing, we no longer write type to the files, if it is a number (=default). Key benefit is fewer allocations (a big problem for ClosedXML).
Other than that, only two files were modified:
 * Sorting.xslx test file was incorrect - the Mixed sheet has a number 9 in the incorrect place (should be just before dates, but was after).
* CellValues.xlsx test file was updated to reflect change of logical-to-text conversion (was True, now TRUE) and TimeSpan-to-text conversion (originally wrote days separately, now days are merged into hours as 24 hours)
@jahav jahav merged commit bbeb961 into develop Dec 11, 2022
@jahav jahav deleted the 1894-data-types branch September 26, 2023 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

XLCell value representation
1 participant