Issue on Export to Excel from RadGriDView

2 posts, 0 answers
  1. P
    P avatar
    4 posts
    Member since:
    Jul 2016

    Posted 28 Oct Link to this post

    Hello  we are facing problem while exporting direct from RadGridView to Excel. After exporting data, three problems are there in excel sheet.

    1. Phone numbers are getting chopped off [Like "8.70772E+11" instead of "870772001799"]

    [Instead of In DataTable PHONENUMBER is in String type]

    2. Phone numbers are displaying as Right Align [Instead data type is String]     

    [Images given "Image .XLS file after exported .png"]

    3. Group name is not showing in Excel sheet  [Only first group is not showing]

    Please advice.

    Screenshot are given & the used code given bellow.  

    private void Button_export_Click(object sender, System.Windows.RoutedEventArgs e)
            {
     
                string extension = "xls";
                string selectedItem = "Excel";
     
                ExportFormat format = ExportFormat.Html;

                SaveFileDialog dialog = new SaveFileDialog();
                dialog.DefaultExt = extension;
                dialog.Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, selectedItem);
                dialog.FilterIndex = 1;
     
                if (dialog.ShowDialog() == true)
                {
                    using (Stream stream = dialog.OpenFile())
                    {
                        GridViewExportOptions options = new GridViewExportOptions();
                        options.Format = format;
                        options.ShowColumnHeaders = true;
                        
                        options.Encoding = Encoding.UTF8;
                        radGridViewSearch.Export(stream, options);
                    }
                }

                MessageBox.Show("Successfully Exported");
     
            }

     

    Thanks

  2. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    279 posts

    Posted 01 Nov Link to this post

    Hello,

    I have tested the behavior and was not able to observe the undesired effects when using the ExportToXlsx extension method of RadGridView.  Please give it a try and update me how it works for you. I have added a sample project for your reference.

    Regards,
    Stefan Nenchev
    Telerik by Progress
    Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top