This is a migrated thread and some comments may be shown as answers.

Dataformatstring property and excel export issue

3 Answers 133 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aswin S
Top achievements
Rank 1
Aswin S asked on 17 May 2013, 07:15 AM
Im not sure whether its a bug or not. I hav a grid with a column as shown below.

<trk:GridBoundColumn DataField="SHORT_TERM_BOIL_OFF" DataFormatString="{0:F2}" SortExpression="SHORT_TERM_BOIL_OFF"
                                           HeaderText="ST He boil off (%/day)" UniqueName="SHORT_TERM_BOIL_OFF">
                                       </trk:GridBoundColumn>

I did export to excel using below code:
trkGridMRStatusOverview.MasterTableView.ExportToExcel();

I got output as attached in the screenshot.
Im getting a text called F2 displayed in excel.

Im using Telerik File version : 2013.1.417.40

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 21 May 2013, 07:28 AM
Hello Aswin,

    Please try the DateFormatstring="{0:F}", because the {0:F2} is for decimal format.
If still you find the fault.let me know the date format you want.

Thanks
Princy
0
Karl
Top achievements
Rank 1
answered on 11 Nov 2013, 07:05 PM
Hi Princy,

I am getting the same behavior.  Below is my html.  Please see attached for output
 

<telerik:RadGrid

ID="RadGrid1YR"

runat="server"

AutoGenerateColumns="false"

AllowSorting="true"

MasterTableView-AllowCustomSorting="true"

OnNeedDataSource="RadGrid_NeedDataSource"

OnSortCommand="RadGrid_SortCommand"

OnItemDataBound="RadGrid1YR_ItemDataBound"

OnBiffExporting="RadGrid1_BiffExporting">

<MasterTableView CommandItemDisplay="Top">

<CommandItemSettings ShowExportToExcelButton="true"></CommandItemSettings>

<Columns>

<telerik:GridNumericColumn DataField="Rank" HeaderText="Rank" DataFormatString="{0:n0}" DataType="System.Int32" />

<telerik:GridBoundColumn DataField="Institution Name" HeaderText="Institution Name" DataType="System.String" />

<telerik:GridNumericColumn DataField="10-YR" HeaderText="10-YR" DataFormatString="{0:f1}" DataType="System.Decimal" />

<telerik:GridNumericColumn DataField="5-YR" HeaderText="5-YR" DataFormatString="{0:f1}" DataType="System.Decimal" />

<telerik:GridNumericColumn DataField="3-YR" HeaderText="3-YR" DataFormatString="{0:f1}" DataType="System.Decimal" />

<telerik:GridNumericColumn DataField="2-YR" HeaderText="2-YR" DataFormatString="{0:f1}" DataType="System.Decimal" />

<telerik:GridNumericColumn DataField="1-YR" HeaderText="1-YR" DataFormatString="{0:f1}" DataType="System.Decimal" />

<telerik:GridNumericColumn DataField="Since 01" HeaderText="Since 01" DataFormatString="{0:f1}" DataType="System.Decimal" />

<telerik:GridNumericColumn DataField="Size($MM)" HeaderText="Size($MM)" DataFormatString="{0:f0}" DataType="System.Decimal" />

<telerik:GridBoundColumn DataField="Privates" HeaderText="Privates" DataType="System.String" />

</Columns>

</MasterTableView>

<ExportSettings SuppressColumnDataFormatStrings="false">

<Excel Format="Biff"></Excel>

</ExportSettings>

</telerik:RadGrid>

0
Karl
Top achievements
Rank 1
answered on 11 Nov 2013, 07:25 PM
I appear to have solved it by using:

DataFormatString="{0:0.0}"


rather than:

DataFormatString="{0:F0}"

Tags
Grid
Asked by
Aswin S
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Karl
Top achievements
Rank 1
Share this question
or