Export to Excel with GridView

7 posts, 0 answers
  1. Elver Emilio Cano Cardona
    Elver Emilio Cano Cardona avatar
    25 posts
    Member since:
    Dec 2009

    Posted 22 Jul 2010 Link to this post

    Good morning

    I have the next case i am using a gridView and i want export a Excel the content the gridView but with exception of any columns. its is possible.. for example i have a GridView with 7 columns and i need export a excel..but only five column of the grid its possible?

    public

     

    void Export(String sFilepath, RadGridView grvExportExcel)

     

    {

     

    try

     

    {

     

    ExportToExcelML exporter = new ExportToExcelML(grvExportExcel);

     

    exporter.SummariesExportOption =

    SummariesOption.ExportAll;

     

    exporter.RunExport(sFilepath);

    }

     

    catch (Exception)

     

    {

     

    throw;

     

    }

    }

    Thanks for your help.
    Best wish
    Elver Cano

  2. Bernd Mueller
    Bernd Mueller avatar
    38 posts
    Member since:
    May 2010

    Posted 22 Jul 2010 Link to this post

    Hi,

    you can set the DoNotExport Option for hiden Columns:

        exporter.HiddenColumnOption = HiddenOption.DoNotExport

    If you set the IsVisible property of the not required columns in the grid to false it should remove them from the export. You can make them visible again after exporting.

    Best regards,

    Bernd
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 26 Jul 2010 Link to this post

    Hello guys,

    Bernd is right. The way to exclude columns from an exported RadGridView is to set their IsVisible property to false and use the DonNotExport option for hidden columns in the export method:
     
    this.radGridView1.SuspendLayout();
    this.radGridView1.Columns[0].IsVisible = false;
    ExportToExcelML exporter = new ExportToExcelML(this.radGridView1);
    exporter.HiddenColumnOption = HiddenOption.DoNotExport;
    exporter.RunExport("c:\\export.xls");
    this.radGridView1.Columns[0].IsVisible = true;
    this.radGridView1.ResumeLayout(false);


    All the best,
    Martin Vasilev
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  5. Alex Wilson
    Alex Wilson avatar
    1 posts
    Member since:
    Dec 2009

    Posted 21 Sep 2010 Link to this post

    I am working with Telerik in ASP.net.

    Can I provide the Excel worksheet's name ?

    Can I merge two radgrids into 1 excel sheet, preferably into two separate worksheets ?

    Can I add in rows such as legend into the spreadsheet to accompany the data ?


                                            Alex
  6. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 24 Sep 2010 Link to this post

    Hi Alex Wilson,

    Thank you for contacting us.

    This thread covers only the RadGridView for WinForms control. Please open a new support thread in appropriate ASP.Net section. This will allow those ASP.NET users who are interested in the same topic to find the answer more easily.

    All the best,
    Martin Vasilev
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  7. Daniela
    Daniela avatar
    1 posts
    Member since:
    Jan 2011

    Posted 31 Mar 2011 Link to this post

    is there any way I can export multiples gridviews in one single excel sheet. I have multiple reports and each report i display it in a gridview. I want to export all gridviews that I have in a page into one single excel sheet.

    can this be done ?

    thank you
  8. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 06 Apr 2011 Link to this post

    Hello Bernd,

    Thank you for writing.

    We do not support the described feature. We will implement it in a future release if we have more
    customers request the same.

    Let me know if you have any other questions.

    Greetings,
    Martin Vasilev
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
Back to Top
UI for WinForms is Visual Studio 2017 Ready