EExport to Excel - RadgridView Silverlight Control

6 posts, 0 answers
  1. Kumar
    Kumar avatar
    8 posts
    Member since:
    Jan 2013

    Posted 14 May 2015 Link to this post

    We are exporting data from rad grid view to excel in one of our applications. Would like to know if there is any limitation on the number of records exported to excel.

    If the number of records are above 55 K then export to excel functionality is not working. Please find the sample code below. Appreciate your help.

    Sample Code:

    private void ExportExcel()

           
    {

               
    BusyIndicator1.IsBusy = true;

               
    try

               
    {

     

                   
    // open file dialog to select an export
    file.  

                    SaveFileDialog sDialog
    = new SaveFileDialog();

                   
    radDataPagerMain.PageSize = 0;

                   
    sDialog.DefaultExt = "*.xlsx";

                   
    sDialog.Filter = "Excel Workbook
    (*.xlsx)|*.xlsx";

                   
    if
    (sDialog.ShowDialog() == true)

                   
    {                   


                        var workbook =
    CreateWorkBook(radGridView1);

     

                       
    if (workbook != null)

                       
    {

                           
    var provider = new XlsxFormatProvider();

                           
    using (var output = sDialog.OpenFile())

       
                        {

                               
    provider.Export(workbook, output);

                           
    }

                       
    }

     

                   
    }

                   
    radDataPagerMain.PageSize = 16;

                   
    BusyIndicator1.IsBusy = false;

               
    }

               
    catch (Exception ex)

               
    {

                   
    MessageBox.Show(ex.Message);

                   


                }

     

           
    }

     

           
    private static Workbook CreateWorkBook(RadGridView grid)

           
    {

               
    try

               
    {    

                   // return workbook;

                   
    Workbook
    book = null;

                   
                   
    using (var stream = new MemoryStream())

                   
    {

                       
    grid.Export(stream, new GridViewExportOptions()

                       
    {

                           
    Format = ExportFormat.Csv,

                           
    ShowColumnFooters = grid.ShowColumnFooters,

                           
    ShowColumnHeaders = grid.ShowColumnHeaders,

                           
    ShowGroupFooters = grid.ShowGroupFooters

                       
    });

     

                       
    stream.Position = 0;

     

                       
    book = new CsvFormatProvider().Import(stream);

                   
    }

                   

                    return book;

               
    }

               
    catch (Exception ex)

               
    {

                   
    MessageBox.Show(ex.Message);

                   
    return null;

               
    }

            }

  2. Stefan X1
    Admin
    Stefan X1 avatar
    521 posts

    Posted 18 May 2015 Link to this post

    Hello Kumar,

    I have tested the exporting of RadGridView on my side, and it is working correctly with more than 55K items. Please bear in mind, that exporting such large amounts of data is highly dependent on the machine on which this functionality is used. I am sorry, but we cannot guarantee that in this case it will be working on absolutely all machines.

    Best Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Kumar
    Kumar avatar
    8 posts
    Member since:
    Jan 2013

    Posted 18 May 2015 in reply to Stefan X1 Link to this post

    Thanks Stefan for your reply but could you please let me know if there is any limitation on the number of records(like a fixed number of records) exported using radgridview (Silverlight control)

    Awaiting reply

  5. Stefan X1
    Admin
    Stefan X1 avatar
    521 posts

    Posted 19 May 2015 Link to this post

    Hi Kumar,

    I have tested exporting up to 800 000 records and the functionality is working correctly. So, for 55 000 items the exporting of RadGridView should be definitely working.

    Best Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Kumar
    Kumar avatar
    8 posts
    Member since:
    Jan 2013

    Posted 19 May 2015 Link to this post

    Thanks Stefan. Could you please send me a sample project to cross check what we are doing wrong
  7. Stefan X1
    Admin
    Stefan X1 avatar
    521 posts

    Posted 20 May 2015 Link to this post

    Hi Kumar,

    Please refer to the RadGridView Integration online demo, as it demonstrates how RadGridView can be exported.

    I hope this helps.

    Best Regards,
    Stefan X1
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner