EEPus - Set cell to format as datetime.

May 29, 2012 at 4:39 PM

Hello, I am trying to get a cell to show up as a datetime: mm/dd/yyyy hh:mm. I have tried to use the predefined style 22 (out of the 164 predefined styles), but I may not be doing this correctly. I keep getting an index out of range error. How do I set a cell to have the correct format in C#, in the code behind file?


Here is what I had: ws.Column(47).Style.XfId = 22;

May 30, 2012 at 7:14 PM

try ws.Column(47).Style.Numberformat.Format = "mm/dd/yyyy";