Hi,
I have a Radgrid with some columns including Time column in format hh:mm:ss:
<telerik:GridBoundColumn HeaderText="POS-CD" DataField="POSCD" UniqueName="POSCD" ReadOnly="True" SortExpression="POSCD" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="START-TIME" DataField="STARTTIME" UniqueName="STARTTIME" ReadOnly="True" SortExpression="STARTTIME" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" DataType="System.String" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn HeaderText="END-TIME" DataField="ENDTIME" UniqueName="ENDTIME" ReadOnly="True" SortExpression="ENDTIME" HeaderButtonType="TextButton" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
</telerik:GridBoundColumn>
For some reason when RadGrid gets exported to excel columns START-TIME and END-TIME showing spaces.
I try to implemented this code:
if (e.RowType == Telerik.Web.UI.GridExcelBuilder.GridExportExcelMLRowType.DataRow)
{
e.Row.Cells.GetCellByName("STARTTIME").StyleValue = "ttST";
}
StyleElement style3 = new StyleElement("ttST");
style3.NumberFormat.FormatType = NumberFormatType.LongTime;
e.Styles.Add(style3);
But it did not work.
Please help me to resolve this problem.
Thanks.
Vitaly.