Quantcast
Channel: NPOI
Viewing all articles
Browse latest Browse all 1621

Created Unassigned: DateTime value appears as numeric value in Excel [13648]

$
0
0
When I try to set cell value from DateTime class and then create Excel i see it there as numeric value, where i need it as date value.

So when i do something like:
```
cell.SetCellValue(DateTime.Now);
cell.CellStyle = datetimeCellStyle;
```

the way i'm creating the format is:
```
var dt = document.CreateDataFormat();

var cellStyle = document.CreateCellStyle();

cellStyle.DataFormat = dt.GetFormat("MMM-dd-yyyy");

return cellStyle;
```

I'm using NPOI 2.1.3 with Excel 2013

Is there any workaround for this issue to have date cell when exported to excel?

Thanks.

Viewing all articles
Browse latest Browse all 1621

Trending Articles



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