I need to write a formatted date to Excel using EPPlus, leaving empty cells where there are no dates to write. I have tried the following:
- Writing a date, and then formatting it. This works unless I have no date, in which case the minimum value is written:
- Formatting the date as a string (passing an empty string when there is no date), then assigning a custom format. The problem with this is that Excel doesn't see the type as a date, therefore a downstream system cannot use it:
How can I write dates to Excel, using EPPlus, where the dates are recognised as date types (not strings), but where missing date values are not written at all?