RadGrid Export to excel unable to maintain Decimal Format for number less than 4 digits

2 posts, 0 answers
  1. Mohd
    Mohd avatar
    19 posts
    Member since:
    Aug 2011

    Posted 21 Dec 2011 Link to this post

    I am trying to export RadGrid to Excel but it seems that that for numbers less than 4 digits decimal formatting is not maintained in Excel
    my code in MainPage.xaml.cs
    public partial class MainPage : UserControl
            public MainPage()
            private void Button1_Click(object sender, RoutedEventArgs e)
                string extension = "xls";
                SaveFileDialog dialog = new SaveFileDialog()
                    DefaultExt = extension,
                    Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "Excel"),
                    FilterIndex = 1
                if (dialog.ShowDialog() == true)
                    using (Stream stream = dialog.OpenFile())
                       // MemoryStream ms = new MemoryStream();
                         new GridViewExportOptions()
                             Format = ExportFormat.Html,
                             ShowColumnHeaders = true,
                             ShowColumnFooters = true,
                             ShowGroupFooters = false,
                        //byte[] header = Encoding.UTF8.GetBytes("Premier League");
                        //stream.Write(header, 0, header.Length);
                        //stream.Write(ms.ToArray(), 0, ms.ToArray().Length);

    and in xaml my code is like
           <my:MyViewModel x:Key="MyViewModel"/>
       <Grid x:Name="LayoutRoot"
             DataContext="{StaticResource MyViewModel}">
               <RowDefinition Height="*"/>
               <RowDefinition Height="Auto" />
               <DataTemplate x:Key="RowDetailsTemplate">
                   <telerik:RadGridView Name="playersGrid"
                                        ItemsSource="{Binding Players}"
                           <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
                           <telerik:GridViewDataColumn DataMemberBinding="{Binding Number}"/>
                           <telerik:GridViewDataColumn DataMemberBinding="{Binding Position}"/>
                           <telerik:GridViewDataColumn DataMemberBinding="{Binding Country}"/>
           <telerik:RadGridView Name="clubsGrid"
                                ItemsSource="{Binding Clubs}"
                                RowDetailsTemplate="{StaticResource RowDetailsTemplate}"
                                Margin="5,37,5,5" Grid.RowSpan="2">
                   <telerik:GridViewDataColumn DataMemberBinding="{Binding Name}"/>
                   <telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
                   <telerik:GridViewDataColumn DataMemberBinding="{Binding StadiumCapacity}"
           <Button Grid.Row="1"

    While i have seperate class for Club, Player, Position and a ViewModel.
    I am attaching Screenshot for further reference.
    Any help would be great
    If possible provide some sample
  2. Mohd
    Mohd avatar
    19 posts
    Member since:
    Aug 2011

    Posted 04 Jan 2012 Link to this post

    Long time no reply
    Still Waiting..  :(
Back to Top