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

Creating a property to get the text plain of a cell ignoring given format in the excel sheet #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidaso28
Copy link

Hello,
First of all, I would like to say congratulations on your fantastic job with this library; it is handy and easy to understand.

I have made just a small change creating a property to determine if the library has to map the value ignoring the cell type or format established and just return plain text.

@codecov
Copy link

codecov bot commented Aug 20, 2020

Codecov Report

Merging #72 into master will decrease coverage by 0.56%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #72      +/-   ##
==========================================
- Coverage   90.34%   89.77%   -0.57%     
==========================================
  Files           6        6              
  Lines         632      636       +4     
  Branches       77       78       +1     
==========================================
  Hits          571      571              
- Misses         50       53       +3     
- Partials       11       12       +1     
Impacted Files Coverage Δ
ExcelMapper/ExcelMapper.cs 86.94% <0.00%> (-0.65%) ⬇️
ExcelMapper/TypeMapper.cs 93.49% <0.00%> (-0.56%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5253506...d6610d8. Read the comment docs.

@mganss
Copy link
Owner

mganss commented Aug 20, 2020

What's the use case for this? Numeric cells that are mapped to string properties should automatically get the formatted value now.

@davidaso28
Copy link
Author

I have some cells that are formatted as date with content 10-11 when I call the fetch method I receive 10/11/2020 if I change the Data Formatter for a custom DataFormatter I would affect whole the date's interpretation. I want to determine with this flag when I want to get the text value and when I want to apply the data format.

Also, when you have a custom format in excel sheet you can avoid any data transformation by demand.

Please let me know if there is another way to achieve this.

Thanks for your quick reply.

@mganss
Copy link
Owner

mganss commented Aug 20, 2020

Sorry, I don't get it. The cells that are date formatted as "10-11" should be mapped to a string property using the format specified in the Excel sheet so you'll get the string "10-11" in your string property. What exactly do you mean with the text value? Date cells are numeric cells and as such are stored as numbers in the Excel sheet. If you don't want/need the formatted string you can always map to a DateTime.

Can you post an example Excel sheet along with the class you're mapping to?

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.

None yet

2 participants