Good Morning All!
I have been developing a project for some time in which users can publish a set of values for a set of dates.
e.g. The user would select a Range in Excel which would contain date values, and an equally sized Range which contains values to publish corresponding to these dates.
What I need to do (C#) is check the cell formatting of both Ranges to see which one is 'actually' a date, I've been using ExcelDNA and since all dates are returned as doubles, I can technically parse my 'values' to dates, and cause all kinds of problems.
If I can get the cell formatting, I can see whether the cell is actually meant to be a date!
Thanks in advance.
The Range.NumberFormat should help you determine if a given cell/range is formatted to a date. If the cell/range is date formatted then the NumberFormat property will contain the format string, i.e. dd/mm/yyyy
来源:https://stackoverflow.com/questions/7964230/how-to-check-excel-cell-format-in-c-sharp-to-see-if-cell-value-is-a-date