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

Export (Negative Currency value like -$321) to Excel from radgridview

7 Answers 71 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sudha
Top achievements
Rank 1
Sudha asked on 07 Jun 2013, 02:07 PM
Hi Everybody,

I am having a small issue while exporting data from Rad grid view(negative currency value) to Excel.

I am having a column called "Balance" binded a currency value in that column using string Format "StringFormat='$\{0:n0\}'", While i export this data into excel negative values are surrounded with parenthesis like ($321) with Red color but i want a value like $-321 in Excel sheet.

If anyone already faced this one and know the solution please post here.

Thanks in Advance





7 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 10 Jun 2013, 08:57 AM
Hello,

The GridView's export method does not control the way the cells in the exported excel document are formatted. By default they should be exported with "-" and not with "()". How are your values formatted in the GridView's cells? How have you implemented the export?

Regards,
Didie
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Sudha
Top achievements
Rank 1
answered on 11 Jun 2013, 05:34 AM
Hi Didie,

I am implemented the Excel report generation as given by the following sample
http://demos.telerik.com/silverlight/#GridView/Exporting

I formatted my balance column using StringFormat='$\{0:n0\}'

<telerik:GridViewDataColumn DataMemberBinding="{Binding Bal,StringFormat='$\{0:n0\}'}" Width="0.78*">
                            <telerik:GridViewDataColumn.Header>
                                <TextBlock Text="Balance ($)"  />
                            </telerik:GridViewDataColumn.Header>
                            <telerik:GridViewDataColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Bal,StringFormat='$\{0:n0\}'}"  />
                                </DataTemplate>
                            </telerik:GridViewDataColumn.CellTemplate>
                        </telerik:GridViewDataColumn>

I am not sure whethere it is a default feature of excel? 
Awaiting for your response...

Thanks,
Sudha
0
Dimitrina
Telerik team
answered on 11 Jun 2013, 08:37 AM
Hello Sudha,

I have attached a screenshot showing the result I got and the options the Excel gives me regarding displaying negative numbers. This behavior may occur if you have selected a non-English location as Your Locale (location) or such a Formatting on your Regional Options (Region and Language).

Regards,
Didie
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Sudha
Top achievements
Rank 1
answered on 11 Jun 2013, 01:02 PM
Thanks for your reply Didie.

Is it possible to show the value as like $-1077 in excel in Export Function itself
Instead of going and changing the Format Cell setting in excel application?
we have to show the value in $-1077 in our exported file didie.

Awaiting your response. 

Thanks,
Sudha 
0
Dimitrina
Telerik team
answered on 11 Jun 2013, 01:06 PM
Hello,

You could subscribe for the ElementExporting event of the RadGridView and change the value to be exported - it is available through the e.Value. You can check this help article as a reference.

Regards,
Didie
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Sony
Top achievements
Rank 1
answered on 01 Jul 2016, 05:11 AM

Hi..
I am using a telerik Radgrid in batch edit mode.I have applied a currency formatting in the GridTemplate column like this: 

<ItemTemplate>

<%# Eval("Test", "{0:C0}")%>

</ItemTemplate>

So I am getting negative numbers in brackets as expected. But when I save the number these negative numbers are saved as positive due to the formatting.How can I get rid of this issue? I want it to be saved as negative itself. i.e, I need the brackets also to be reflected in the new value of the radgrid

0
Stefan Nenchev
Telerik team
answered on 04 Jul 2016, 07:03 AM
Hi Sony,

There is no such column within the Telerik Silverlight RadGridView control. It seems to me that you need information for another technology and product. Please create a thread in the respective forum(I believe your issue is related to the UI for ASP.NET AJAX suite) or raise a ticket for the related technology in order to get more information. 

Regards,
Stefan Nenchev
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
GridView
Asked by
Sudha
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Sudha
Top achievements
Rank 1
Sony
Top achievements
Rank 1
Stefan Nenchev
Telerik team
Share this question
or