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

Export to excel formatting

2 Answers 131 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kavi
Top achievements
Rank 1
Kavi asked on 11 Jul 2010, 09:31 AM

Hi,

I've a gridview and i have implemented export to excel, the exported data is not is the format as in the grid.
The numeric columns are a bit strange, the positive data is exported normally in case if there is a negative data the excel has a red colored font.

$213,213.00
 is the same as in the grid, whereas -$98,766.00 is exported as given below.
($98,766.00)



Please let me know what could be done to display negative numbers.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 12 Jul 2010, 07:33 AM
Hello,

 Excel will format automatically negative numbers like this. You can set DataFormatString for this column or use Exporting event to export desired value similar to this demo.

Kind regards,
Vlad
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
Kavi
Top achievements
Rank 1
answered on 12 Jul 2010, 10:24 AM

Hello,

DataFormatString="{}{0:$###,##0.00}" is the one i'm currently using for my column, if i change the DataFormatString="{}{0:c}"   at first instant the grid wouldn't show up the negative sign. Also how to format a particular column for its datatypes with excel exporting event, a sample would be helpful.

Tags
GridView
Asked by
Kavi
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Kavi
Top achievements
Rank 1
Share this question
or