May 6, 2010 at 11:21 AM

Hey. I'm hoping to use EPPlus to read and write Xlsx files. However, I'm having problems figuring out how to handles dates. If I set a cell value to a DateTime, the file looks to convert the date into a number (which I know Excel stores dates as), but when the file is opened in either Excel or EPPlus the DateTime is returned as a number.

Do you have an example on how to set a cell value to a Date?


May 6, 2010 at 11:26 AM

You must set the numberformat to a date format (ex worksheet.cells["a1:a5"].Style.NumberFormat.Format="yyyy-MM-dd"). Have a look at the sample project.