Ignore grouping header when exporting to Excel

17 posts, 0 answers
  1. Robert LeGood
    Robert LeGood avatar
    28 posts
    Member since:
    Dec 2007

    Posted 12 Mar 2008 Link to this post

    Hi all,

    I have a rad grid table where one of the columns is the "Group By" column.  When I export to excel, all I want is just the data exported in the order that is presented on the screen, but I get the extra "header" group by lines.  IE...

    COL1         COL2         COL3
    COL1: 12345
    12345         xxx               yyy
    12345         fygr               dhet
    12345         kljasdflk         qweqwe
    COL1: 56789
    56789         iouoaisuio     oiuiou
    56789         werwer         ewrwer

    How I can the export to excel to NOT export the group by header lines?  I have "ExportOnlyData" set to true.

    I tried the following just before the export...

    RadGrid1.GroupingEnabled = false;
    RadGrid1.Rebind();

    ...but the rebind changed the order of the rows so that the data was no longer grouped.

    Thanks!
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 17 Mar 2008 Link to this post

    Hi Robert LeGood,

    Try the following:

     protected void Button1_Click(object sender, EventArgs e)
        {
            //setup properties for the data export
            RadGrid1.ExportSettings.ExportOnlyData = true;
            RadGrid1.ExportSettings.OpenInNewWindow = true;
            foreach (GridGroupHeaderItem groupItem in     this.RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader))
            {
                groupItem.Visible = false;
            }
            RadGrid1.MasterTableView.ExportToExcel();
        }

    Hope this helps.

    Greetings,
    Steve
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Robert LeGood
    Robert LeGood avatar
    28 posts
    Member since:
    Dec 2007

    Posted 17 Mar 2008 Link to this post

    Thanks Steve!   That did the trick!

    This may be a good candidate for an Export Setting as I could see this behavior often desired.

    Thanks again,

    R.
  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 18 Mar 2008 Link to this post

    Hi Robert,

    Great suggestion. I've included it in our "future list of features" and it would be considered for implementation in one of the subsequent versions of the control.

    Your Telerik points have been updated for bringing this to our attention.

    Greetings,
    Steve
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. eric
    eric avatar
    35 posts
    Member since:
    Mar 2009

    Posted 01 Jun 2010 Link to this post

    Has this been implemented by any of the subsequent releases?  I did some poking around but couldn't find anything.
  7. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 02 Jun 2010 Link to this post

    Hello Eric,

    Thank you for your question.

    Since there is a pretty straightforward way to remove the group headers manually, we decided to drop the implementation of this functionality.

    Please excuse us for the inconvenience.

    Best regards,
    Daniel
    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.
  8. eric
    eric avatar
    35 posts
    Member since:
    Mar 2009

    Posted 02 Jun 2010 Link to this post

    Ok thanks.

    Also, an fyi....

    If you are using grid group by expressions and dont want the grouping rows in your export use the following...

    Me

     

    .radgrid1.MasterTableView.GroupByExpressions.Clear()

     

  9. Shubh
    Shubh avatar
    12 posts
    Member since:
    Jul 2010

    Posted 06 Aug 2010 Link to this post

    Hi,
    I want the grid to export data to excel alongwith the group header content.But it is everytime exporting the data by removing the group header contents. Please let me know how to do it.

    Regards,
    Shubh
  10. Shubh
    Shubh avatar
    12 posts
    Member since:
    Jul 2010

    Posted 09 Aug 2010 Link to this post

    Any help?
  11. Shubh
    Shubh avatar
    12 posts
    Member since:
    Jul 2010

    Posted 09 Aug 2010 Link to this post

    Ok I got where is the problem exactly but need solution from Telerik support team.

    The thing is my group headers are not coming while exporting since I am writing the following code:
    if (e.Item is GridGroupHeaderItem)
    {
    (e.Item
    as GridGroupHeaderItem).DataCell.Visible = false;
    e.Item.PreRender +=
    new EventHandler(Item_PreRender);
    }
    which is hiding the GroupHeaders DataCell since I need to customize the header as demonstrated in the following link
    http://www.telerik.com/help/aspnet-ajax/aligning_items_in_groupheader2.html

    Now,Please let me know with (e.Item as GridGroupHeaderItem).DataCell.Visible = false;
     and creating my own Table cells for the group header how can I bring the group header while exporting to excel?
  12. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 12 Aug 2010 Link to this post

    Hello Shubh,

    Please download the attached demo and let me know how to modify it so that I can reproduce the problem locally.

    Regards,
    Daniel
    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
  13. Gjoko
    Gjoko avatar
    1 posts
    Member since:
    Jul 2013

    Posted 24 Jul 2013 Link to this post

    Hi
    It doesn't work after i add "IgnorePaging=true". I want to be exported all the records. 
    Is there any workaround?
    Thanks
  14. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 29 Jul 2013 Link to this post

    Hello Gjoko,

    Could you please let me know what functionality do you need?

    Regards,
    Daniel
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  15. Danilo
    Danilo avatar
    40 posts
    Member since:
    Sep 2012

    Posted 07 Mar in reply to Steve Link to this post

    Hello.

    I am experiancing a functionality difference between Telerik versions in the Biff Excel export.

    I have upgradet from version  2015.2.826.45  to version 2016.1.225.45.

    In the new version I have the following two issues:

    1. First the html from "GroupHeaderTemplete" content is displayed as a separate row.

        The HideStructureColumns property removes the html content but he empty line remains.

    2. On a larger grid the old version takes 1 secend or so to export the excel file.

     

  16. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 09 Mar Link to this post

    Hello Danilo,

    Most probably the changes are caused by the fact that we introduced grouping support for xlsx and biff formats.
    That said, I noticed that you have submitted a support ticket and you are already discussing that matter with Kostadin so I would suggest that you continue that conversation if need be.

    Regards,
    Daniel
    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
  17. Sumathi
    Sumathi avatar
    5 posts
    Member since:
    Apr 2015

    Posted 24 Mar Link to this post

    Hi,

    I am having problem exporting grid data to excel. I am hiding/showing certain columns in radgrid on a dropdown options. That part is done in radGrid_PreRender like this:

    radGrid.MasterTableView.GetColumn("Date").Display = false;

    Here is my aspx grid definition:

    <telerik:RadGrid ID="gridDCCodeAnalysis" runat="server" AutoGenerateColumns="false"
                                    Skin="Office2007" AllowPaging="True" AllowSorting="True" GroupPanelPosition="Top"
                                    PagerStyle-Mode="NextPrevAndNumeric" OnNeedDataSource="gridDCCodeAnalysis_NeedDataSource"
                                    AllowFilteringByColumn="True" FilterItemStyle-Height="10px" ResolvedRenderMode="Classic"
                                    ExportSettings-OpenInNewWindow="true"  UseAllDataFields="true"
                                    OnHTMLExporting="gridDCCodeAnalysis_Exporting" 
                                    onprerender="gridDCCodeAnalysis_PreRender" 
                                    onitemdatabound="gridDCCodeAnalysis_ItemDataBound">
                                    <HeaderStyle Font-Bold="true" HorizontalAlign="Center" Font-Size="Smaller" Font-Names="Verdana" />
                                    <ItemStyle Font-Size="Smaller" />
                                    <AlternatingItemStyle Font-Size="Smaller" />
                                    <ExportSettings OpenInNewWindow="true" ExportOnlyData="true" Excel-Format="Xlsx">
                                    </ExportSettings>

                                      <Columns>

                                        ......

                                       </Columns> </Radgrid>

     

    I also have column grouping. When I set excel format to Xlsx, I get a run time error. But, if no option is given or option is ExcelML, no data is exported. Am I missing something ? Any lead would be very helpful. Thanks in advance

  18. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 25 Mar Link to this post

    Hello Sumathi,

    I would recommend that you use Visible=false, instead of Display=false. Other than that I'm not sure what exactly causes the problem you described. Can you please post a self-contained code snipped which I could run at my side and reproduce the problem?

    Regards,
    Daniel
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017