This project has moved and is read-only. For the latest updates, please go here.

Parsing file with mix of dates and numeric/decimal values

Aug 14, 2012 at 9:47 PM

I'm currently working on a project and when the cell has a DataType everything is great.  If there is no DataType associated with the cell, I'm trying to determine what the value/format should be.  Currently I'm getting the NumberFormatId for dates but they are all over the place, >= 14 && <=22, then there are some at 217, 326 etc.  What I was looking to find a way to pull the actual format code mask and then based on the format code mask determine if the format code is a date or not. 

I've looked at the way ClosedXML works and it is close but converting to double or DateTime.FromOADate won't work because what if I pull back a value of "40724" without knowing the format code I don't know if this is a date or a double as both convert fine.  I'm running into issues with this as I'm saving date values to a database table with a date dataType and also saving non date or string values to a decimal dataType.

Not sure if you have run into this type of issue and looking for any insight.



Aug 15, 2012 at 8:59 PM

I don't quite understand the problem. Create an issue, attach an Excel file and let me know which value you're trying to extract.