We have an Infragistics grid with dates formatted 2 different ways. + For US we have 2011-04-26 2:30 PM + For UK we have 26-04-2011 7:30 PM (adjusted for timezones)
Everything works great, except when you export to Excel a UK formatted date the 7:30 turns into "19:30" in excel (a 24 hour format). Our users are not use to seeing this time format. It is strange that the US formatted dates export perfectly, meaning it retains the "2:20 PM" formatting.
We are using Infragistics3.Excel.v10.1and Infragistics2.Win.UltraWinGrid.v10.1.We do not have control over what company approved Infragistics version we use. We can just upgrade until a new version is approved for the compnay.
Does anyone know how to fix this? It seems like a small bug that could have easily gone unnoticed.
Thanks.
Hi,
How are you achieving the Format on the cells in the grid? I assume you must be using an editor if the dates are in the same column. But are you using an owner to acheive the different formats? Or a DataFilter? Or something else?
When the grid exports to Excel, it does not export any formatting for DateTime cells. Is it possible your field is storing the dates as strings?
Are you applying a format to the Excel column using the InitializeColumn event of the UltraGridExcelExporter?
Hi Mike, thanks for the reply.
I am not doing anything to change the Excel format. Apparently a grid using AppStyling = true when the application loads Office2007Blue.isl automatically keeps the formatting from the grid when exported. Office2007Blue.isl was downloaded from your site or bundled in your samples. It was not one we created. I removed the isl file from the project and the format no longer exported over to Excel.
To add formatting to the grid I use: UltraGrid.DisplayLayout.Bands[0].Columns[0].Format = "...";It is just odd that dates formatted in for US worked, but UK does not. I see no ryme or reason. :(
Well, not I am not so sure about the isl file. I don't know how the formatting is being applied in Excel. I do not see anything of our code doing it. :/
Thanks!! I will investigate the UltraGridExcelExporter's CellExported event.
I found the problem (or turns out not to be a problem)
The UltraGridExelExport(grid, worksheet) uses the CurrentCulture of the thread for formatting dates. I just need to change my settings in the Control Panel for 'en-BG'.
Thanks! False alarm. :)