Iam exporting date column values e.g. 23/11/2023 using Telerik to an .xlsx excel file.
From exported excel, if you right click the value -> Choose Format cell, it is showing as General
How can this be shown as Date. What changes to make in Telerik file before exporting.
1 Answer, 1 is accepted
0
Petar
Telerik team
answered on 05 Mar 2025, 11:49 AM
Hi Sujith,
Could you please provide more details about the issue you are experiencing? When you mentioned that the default formatting is set to "General", does this mean you are seeing the date displayed incorrectly in the XLSX file? For instance, is it showing up as a number instead of in the date format?
That being said, I attempted to reproduce this issue by adding a SqlDataSource component to the report and setting the Format property for the text box that displays the date:
As a result, the dates were rendered in the correct format in the XLSX file:
And the "Format Cells" option indicated a Custom format being applied:
Once again, I would greatly appreciate it if you could provide more details about the issue you are experiencing. Additionally, it would be very helpful if you could share a sample report file that demonstrates the problem so I can investigate it locally. Thank you!
You can achieve this behavior by using the device information setting called UseExtendedFormatting for XLSX rendering. By default, it is set to True to preserve the data being affected by culture-specific settings. However, you can set it to False through the extensions element of the report engine configuration. If you haven't already, you can look at the following documentation article on how to set it up:
Once you have the configuration applied, if you use a standard DateTime format string for the Format property of the corresponding text box containing the dates, such as {0:d}:
If you follow the above steps, you should be able to see the correct format being applied by default:
I hope this helps. Please let me know if you need any further assistance regarding this matter.