We have an Export to Excel routine that's been working fine. It exports the DataGridView cell values to Excel. I've recently been asked if we can make the Excel data look like what's in the DataGridView. For instance if the value of the cell is "5/19/2013 12:00:00 AM" but the displayed text is "19 May 2013", the "19 May 2013" is what I want to bring into Excel. I would have thought there would be a .Text property of a cell in addition to its .Value property but no such luck. I'm assuming that's because a cell can contain things other than text. Currently we're not handling anything other than text in our DataGridViews. So now I'm thinking I may have to determine the format of the cell's data and apply that to it's Value to get what I want, something like this:
Any other suggestions?
Thanks
Code:
Convert.ToDateTime(currRow.Cells(colName).Value).ToString("MM/dd/yyyy")
Thanks