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

Export To CSV - Decimal places

2 Answers 41 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Deepak
Top achievements
Rank 1
Deepak asked on 07 Apr 2011, 04:45 PM
Hi,
      I am trying to set the decimal places in the export to be a customizable setting. I am using the following lines of code


col.ExcelExportType =

 

DisplayFormatType.Currency

 

 

col.ExcelExportFormatString = GetDecimalFormat()



WHere the GetDecimalFormat would return "{0:#.##} for 2 decimal places.

But this snipet does not work. It renders on the csv witht the same number of decimal places as in the data. Are there similar properties for csv as there are for excel?

Thanks
Deepak

2 Answers, 1 is accepted

Sort by
0
Deepak
Top achievements
Rank 1
answered on 07 Apr 2011, 05:03 PM
Fixed it using the CSVCellFormatting event.
Explicitly formated the e.csvelement.value to take the configured decimal places

Thanks
Deepak
0
Martin Vasilev
Telerik team
answered on 12 Apr 2011, 12:26 PM
Hello Deepak,

I am glad you have found solution to your requirement. Using the CSVCellFormatting event is the right way to format the result values in exported file. 

Do not hesitate to contact us again if you have any other questions.

Best wishes,
Martin Vasilev
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
Tags
GridView
Asked by
Deepak
Top achievements
Rank 1
Answers by
Deepak
Top achievements
Rank 1
Martin Vasilev
Telerik team
Share this question
or