Hi Freinds,
I have a radgrid with data in the grid having timing as hh:mm:ss whenever i click in excel export the containing hh:mm:ss that get converted to Total second in excel, i bind my radgrid with datatable having timing as total second (60 i.e get converted to 00:01:00 with timespan) but when i export it to excel it shows me as 60 in the column but actualy radgrid contains 00:01:00. Excel also should show 00:01:00. I hav also used
I have a radgrid with data in the grid having timing as hh:mm:ss whenever i click in excel export the containing hh:mm:ss that get converted to Total second in excel, i bind my radgrid with datatable having timing as total second (60 i.e get converted to 00:01:00 with timespan) but when i export it to excel it shows me as 60 in the column but actualy radgrid contains 00:01:00. Excel also should show 00:01:00. I hav also used
RadGrid1.ExportSettings.Excel.Format = Telerik.Web.UI.
GridExcelExportFormat.ExcelML;
RadGrid.MasterTableview.ExportToExcel()
and
RadGrid1_ExcelMLExportStylesCreated,
RadGrid1_ExcelMLExportRowCreated.
I just want get whatever in radgrid as it is in excel.
How to achieve this please let me know.
Thanks in advance.
Manoj Gupta
5 Answers, 1 is accepted
0
Hello Manoj,
Please examine the Custom Styles and Number Formats sections in the following link:
ExcelML basics
Let me know whether this helps.
Kind regards,
Daniel
the Telerik team
Please examine the Custom Styles and Number Formats sections in the following link:
ExcelML basics
Let me know whether this helps.
Kind regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Asha
Top achievements
Rank 1
answered on 03 Nov 2012, 08:44 AM
Hi,
I am facing almost the same issue.The radgrid shows value in the format "hh:mm:ss".But after export,the column is blank.
I have mentioned the data type of the Grid column as "System.Timespan"
Also added a style element with the custom format "hh:mm:ss" and aasigned it to the cells in the Timespan column.
This works fine if I change the grid column datatype to String..But this will not allow calculations in the exported excel.
Please help.
Regards,
Asha
I am facing almost the same issue.The radgrid shows value in the format "hh:mm:ss".But after export,the column is blank.
I have mentioned the data type of the Grid column as "System.Timespan"
Also added a style element with the custom format "hh:mm:ss" and aasigned it to the cells in the Timespan column.
This works fine if I change the grid column datatype to String..But this will not allow calculations in the exported excel.
Please help.
Regards,
Asha
0

Shinu
Top achievements
Rank 2
answered on 05 Nov 2012, 04:58 AM
Hi,
Try setting the mso number format as shown below.
C#:
Thanks,
Shinu.
Try setting the mso number format as shown below.
C#:
protected
void
RadGrid1_ExportCellFormatting(
object
sender, ExportCellFormattingEventArgs e)
{
if
((e.FormattedColumn.UniqueName) ==
"Uniquename"
)
{
e.Cell.Style[
"mso-number-format"
] = @
"dd.MM.yyyy hh:mm:ss"
;
}
}
Thanks,
Shinu.
0

Asha
Top achievements
Rank 1
answered on 05 Nov 2012, 09:46 AM
This does not work.I have added the event mentioned in the aspx page like this:
OnExportCellFormatting
="GridDriverHours_ExportCellFormatting"
and added the event in the code behind:
But this event does not seem to fire when I debug.
Note:I am using
GridDriverHours.ExportSettings.Excel.Format =
GridExcelExportFormat.ExcelML;
0
Hello Asha,
The code suggested by Shinu works for HTML Excel format only. This is why the event will not fire.
For ExcelML you can use the approach mentioned in the corresponding help topic:
ExcelML basics
Kind regards,
Daniel
the Telerik team
The code suggested by Shinu works for HTML Excel format only. This is why the event will not fire.
For ExcelML you can use the approach mentioned in the corresponding help topic:
ExcelML basics
Kind regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.