Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

Commented Unassigned: Datetimes read as double [9091]

$
0
0
Hello friends,

I'm having a problem while reading an .xls using ClosedXML

I'm trying to copy a worksheet into an html table. However, when I get down to the cells that have dates on them (see sample.xls), this is what I get:

Cell.GetFormattedString() = $-4417089]d-mmm-yy
Cell.Value = + 41708.0 {Double}

So, the value is taken as a double instead of a Date, and I haven't found any way to correct this. Any clues?

My version of ClosedXML is 0.59.0.0. However, I've downloaded the latest one, and I get the same results.

Thank you!
Comments: ** Comment from web user: SeanKilleen **

Have you tried something like this in the code that reads the Excel file?

``` C#
var resultDate = yourCellName.GetValue<DateTime>();
```

I think if the date is a date in Excel, that should return a DateTime, which you could then work with normally and format, etc.

Let me know if I'm not understanding correctly.


Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>