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

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

0 Answers 116 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Mohd asked on 21 Dec 2011, 01:58 PM
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 and Position.
I am attaching Screenshot for further reference.
Any help would be great
If possible provide some sample

No answers yet. Maybe you can help?

Asked by
Top achievements
Rank 1
Share this question