String not getting correctly, While exporting grid into excel. I am using "GridExcelExportFormat" is "Xlsx". Before exporting into excel the number string are showing correctly. But after exporting those numbers are automatically converted into date format. I am used "SuppressColumnDataFormatStrings" true/false, then also getting same issue. Please help me.
Grid column datatype is string.
Grid column datatype is string.
6 Answers, 1 is accepted
0
Hello Purna,
This works fine on my end. Please try the following setup and let me know if it behaves correctly at your side.
Regards,
Daniel
Telerik
This works fine on my end. Please try the following setup and let me know if it behaves correctly at your side.
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
>
<
MasterTableView
CommandItemDisplay
=
"Top"
>
<
CommandItemSettings
ShowExportToExcelButton
=
"true"
/>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"col1"
/>
</
Columns
>
</
MasterTableView
>
<
ExportSettings
>
<
Excel
Format
=
"Xlsx"
/>
</
ExportSettings
>
</
telerik:RadGrid
>
void
RadGrid1_NeedDataSource(
object
sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
DataTable table =
new
DataTable();
table.Columns.Add(
"col1"
);
table.Columns.Add(
"col2"
);
for
(
int
i = 0; i < 10; i++)
{
table.Rows.Add(
"23:00-00:00"
, i);
}
RadGrid1.DataSource = table;
}
Regards,
Daniel
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
0
Hello Purna,
I suppose that the value might get parsed in a different way for your culture. In this case, you can force this column's cells to be in "text" format as demonstrated below:
I hope this helps.
Regards,
Daniel
Telerik
I suppose that the value might get parsed in a different way for your culture. In this case, you can force this column's cells to be in "text" format as demonstrated below:
protected
void
RadGrid1_InfrastructureExporting(
object
sender, GridInfrastructureExportingEventArgs e)
{
foreach
(Cell cell
in
e.ExportStructure.Tables[0].Columns[1].Cells)
{
cell.Format =
"@"
;
}
}
I hope this helps.
Regards,
Daniel
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
purna
Top achievements
Rank 1
answered on 10 Dec 2014, 03:45 PM
Hello Daniel,
Thanks for your response.
I applied cell format, as per suggestion. But i am not get success.
PFA.
Please help me in this issue.
Thanks & Regards,
Purna.
Thanks for your response.
I applied cell format, as per suggestion. But i am not get success.
PFA.
Please help me in this issue.
Thanks & Regards,
Purna.
0
0
Hello Purna,
Please make sure that you have applied this format to the correct column. It might be column "2" in your case.
Regards,
Daniel
Telerik
Please make sure that you have applied this format to the correct column. It might be column "2" in your case.
Regards,
Daniel
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.