Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
After export date column is not recognized automatically in exported excel sheet. Using Infragisitcs.Documents.Excel.WorksheetCell class.
posted

I am using Infragistics.Controls.Grids.XamGrid in a silverlight application. I am using the assembly-  

clr-namespace:Infragistics.Controls.Grids;assembly=InfragisticsSL5.Controls.Grids.XamGrid.v14.2.

I am exporting the grid data using  Infragisitcs.Documents.Excel.WorksheetCell class, after export date column is not recognized automatically in exported excel sheet.

After applying filter on date column in exported excel sheet, I do not find  "Date Filters", it is still there as "Text Filters"

As date column is not recognized as date in exported excel sheet then the sorting can be wrong and we cannot drill down the filter in excel (year -> month -> date)


Appreciate if any one answers with some hints or solution.

My code sample is as below for reference:

string format = Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;

SetCellValue(sheetOne.Rows[rowIndex].Cells[currentCell],
(cell.Row.Data as IGenericDomainObjectWrapper).GetValue(cell.Column.Key), format);

void SetCellValue(WorksheetCell cell, object value, string format = "")

{

 cell.Value = TryParseDate(value.ToString(), format);

cell.CellFormat.FormatString = Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern;

cell.CellFormat.ShrinkToFit = ExcelDefaultableBoolean.False;
cell.CellFormat.VerticalAlignment = VerticalCellAlignment.Center;
cell.CellFormat.Alignment = HorizontalCellAlignment.Left;

}