Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am having a telerik RadGrid with two columns (Col1 and Col2 ) and it is loaded with two values, one integer ( for Col1 ) and one real ( Col2) type values from database.

For exporting , I have made number format to decimal through these,

C#
protected void rdData_ExcelMLExportStylesCreated(object source, GridExportExcelMLStyleCreatedArgs e)
{
    StyleElement style = new StyleElement("MyNumberStyle");
    style.NumberFormat.FormatType = NumberFormatType.General;
    style.NumberFormat.Attributes["ss:Format"] = "0.0";
    e.Styles.Add(style);
}


protected void rdData_ExcelMLExportRowCreated(object source, GridExportExcelMLRowCreatedArgs e)
{
    e.Row.Cells.GetCellByName("Col1").StyleValue = "MyNumberStyle";
    e.Row.Cells.GetCellByName("Col2").StyleValue = "MyNumberStyle";

}


Here is my export setting:

C#
rdData.ExportSettings.ExportOnlyData = true;
rdData.ExportSettings.IgnorePaging = true;
rdData.ExportSettings.OpenInNewWindow = true;       
rdData.ExportSettings.Excel.Format = Telerik.Web.UI.GridExcelExportFormat.ExcelML;        
rdData.MasterTableView.ExportToExcel();


My question is :
While exporting to excel the Col1 is formatted with 0.0 ( ex : 1.0 )
but the real type column is getting as null.


Please help me.
Posted
v2

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900