Hi, when I use
row.GetCellValue(column.Index).ToString()I get number value but in excel column I have date value :(.In excel file the cell format is date and I see value in date format (dd.mm.yyyy).
In my case in the excel sheet I have value 21.2.2002 (dd.mm.yyyy) and row.GetCellValue(column.Index).ToString() returns value 37308.
Could you advise how to get correct date value?
Thank youLibor
I tried to find cell format out.
And here is my list of CellFormat properties. No information regarding date format :(
?column.CellFormat{Infragistics.Documents.Excel.WorksheetColumnOwnedFormatProxy} [Infragistics.Documents.Excel.WorksheetColumnOwnedFormatProxy]: {Infragistics.Documents.Excel.WorksheetColumnOwnedFormatProxy} Alignment: Default BottomBorderColor: "{Name=0, ARGB=(0, 0, 0, 0)}" BottomBorderColorInfo: null BottomBorderStyle: Default DiagonalBorderColor: "{Name=0, ARGB=(0, 0, 0, 0)}" DiagonalBorderColorInfo: null DiagonalBorders: Default DiagonalBorderStyle: Default Fill: null FillPattern: Default FillPatternBackgroundColor: "{Name=0, ARGB=(0, 0, 0, 0)}" FillPatternForegroundColor: "{Name=0, ARGB=(0, 0, 0, 0)}" Font: {Infragistics.Documents.Excel.WorkbookFontOwnerAccessor} FormatOptions: None FormatString: null Indent: -1 LeftBorderColor: "{Name=0, ARGB=(0, 0, 0, 0)}" LeftBorderColorInfo: null LeftBorderStyle: Default Locked: Default RightBorderColor: "{Name=0, ARGB=(0, 0, 0, 0)}" RightBorderColorInfo: null RightBorderStyle: Default Rotation: -1 ShrinkToFit: Default Style: Built in style: Normal TopBorderColor: "{Name=0, ARGB=(0, 0, 0, 0)}" TopBorderColorInfo: null TopBorderStyle: Default VerticalAlignment: Default WrapText: Default
Hi Libor2244,
As Mike has suggested, the most direct approach to obtaining the cells DateTime value, when using a DateTime format would be to use the GetCellText method; available with the 12.1 assemblies.
Please let me know if you require any further assistance regarding this behavior.
Sincerely,Chris KDeveloper Support EngineerInfragistics, Inc.www.infragistics.com/support
Dates are actually stored in an Excel file as numbers. It is the cell's format string which then displays it as a date. If you are using version 12.1, there is a new GetText() method on the cell which you can use. This will combine the data with the format string to produce the value displayed to the user in Excel.