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

Ignore grouping header when exporting to Excel

16 Answers 837 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert LeGood
Top achievements
Rank 1
Robert LeGood asked on 12 Mar 2008, 02:06 PM
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!

16 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 17 Mar 2008, 03:01 PM
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
0
Robert LeGood
Top achievements
Rank 1
answered on 17 Mar 2008, 03:14 PM
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.
0
Steve
Telerik team
answered on 18 Mar 2008, 02:38 PM
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
0
eric
Top achievements
Rank 1
answered on 01 Jun 2010, 11:00 PM
Has this been implemented by any of the subsequent releases?  I did some poking around but couldn't find anything.
0
Daniel
Telerik team
answered on 02 Jun 2010, 05:24 PM
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.
0
eric
Top achievements
Rank 1
answered on 02 Jun 2010, 05:34 PM
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()

 

0
Shubh
Top achievements
Rank 1
answered on 06 Aug 2010, 10:31 AM
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
0
Shubh
Top achievements
Rank 1
answered on 09 Aug 2010, 08:22 AM
Any help?
0
Shubh
Top achievements
Rank 1
answered on 09 Aug 2010, 10:44 AM
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?
0
Daniel
Telerik team
answered on 12 Aug 2010, 10:14 AM
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
0
Gjoko
Top achievements
Rank 1
answered on 24 Jul 2013, 11:02 AM
Hi
It doesn't work after i add "IgnorePaging=true". I want to be exported all the records. 
Is there any workaround?
Thanks
0
Daniel
Telerik team
answered on 29 Jul 2013, 08:52 AM
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.
0
Danilo
Top achievements
Rank 1
answered on 07 Mar 2016, 10:29 AM

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.

 

0
Daniel
Telerik team
answered on 09 Mar 2016, 04:49 PM
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
0
Sumathi
Top achievements
Rank 1
answered on 24 Mar 2016, 06:50 PM

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

0
Daniel
Telerik team
answered on 25 Mar 2016, 09:07 AM
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.
Tags
Grid
Asked by
Robert LeGood
Top achievements
Rank 1
Answers by
Steve
Telerik team
Robert LeGood
Top achievements
Rank 1
eric
Top achievements
Rank 1
Daniel
Telerik team
Shubh
Top achievements
Rank 1
Gjoko
Top achievements
Rank 1
Danilo
Top achievements
Rank 1
Sumathi
Top achievements
Rank 1
Share this question
or