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

8 posts, 0 answers
  1. Sudha
    Sudha avatar
    3 posts
    Member since:
    Dec 2012

    Posted 07 Jun 2013 Link to this post

    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





  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 10 Jun 2013 Link to this post

    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.

  3. DevCraft banner
  4. Sudha
    Sudha avatar
    3 posts
    Member since:
    Dec 2012

    Posted 11 Jun 2013 Link to this post

    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
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 Jun 2013 Link to this post

    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.

  6. Sudha
    Sudha avatar
    3 posts
    Member since:
    Dec 2012

    Posted 11 Jun 2013 Link to this post

    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 
  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 Jun 2013 Link to this post

    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.

  8. Sony
    Sony avatar
    2 posts
    Member since:
    Mar 2015

    Posted 01 Jul Link to this post

    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

  9. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    281 posts

    Posted 04 Jul Link to this post

    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.
Back to Top
DevCraft banner