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
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
This may be a good candidate for an Export Setting as I could see this behavior often desired.
Thanks again,
R.
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
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.
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()
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
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?
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
It doesn't work after i add "IgnorePaging=true". I want to be exported all the records.
Is there any workaround?
Thanks
Could you please let me know what functionality do you need?
Regards,
Daniel
Telerik
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.
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
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
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