This is a migrated thread and some comments may be shown as answers.
Clarification in Hierarchical Excel Export
2 Answers 29 Views
This is a migrated thread and some comments may be shown as answers.
Chandran Chandran
Top achievements
Rank 1
Chandran Chandran asked on 21 Jul 2010, 01:15 PM
Dear Telerik,

I am having the RadGrid which is also having child details showing through hierarchical method of grid. I have the following doubts to Export the grid into Excel.

* Need to export the parent grid and hierarchical or child details only if it is expanded.
* I would like to show only the datas means columns and rows of parent and child rather than displaying the items like   filter,expand/collapse, add/referesh/edit buttons etc.
* I used the follwing block of code to export excel. But it seems i am not not getting the proper positin of the columns means columns showing right side and rows are showing left side of the excel sheet. It is also exporting all of the child rows from the grid eventhough i am not expanding all of them.
private void ConfigureExcelExport()
    {
        //ExportExcel configuration settings
        //rgPostingBill.MasterTableView.Caption = "PostingNotice Billing Report";
        RadGrid1.ExportSettings.FileName = "PostingNotice";
        RadGrid1.ExportSettings.IgnorePaging = true;
        //RadGrid1.ExportSettings.HideStructureColumns = true;
        RadGrid1.MasterTableView.HierarchyDefaultExpanded = true;   
        RadGrid1.ExportSettings.ExportOnlyData = true;           
        RadGrid1.ExportSettings.OpenInNewWindow = true;
    }
 protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (isExcelExport)
        {
            if (e.Item is GridNoRecordsItem)
                e.Item.Visible = false;
  
            if (e.Item is GridCommandItem)
                e.Item.Visible = false;
  
            //if (e.Item is GridNestedViewItem)
            //    e.Item.Cells[0].Visible = false;
  
            //if (e.Item is GridDataItem)
            //{
            //    GridDataItem item = e.Item as GridDataItem;
            //    foreach (GridColumn col in e.Item.OwnerTableView.RenderColumns)
            //        if (!(col is GridBoundColumn))
            //            item[col.UniqueName].Visible = false;
            //}
        }
    }


Hope my above code and scenario is understandable.If so please let me know the possibilites.

-Thanks in Advance

2 Answers, 1 is accepted

Sort by
0
Chandran Chandran
Top achievements
Rank 1
answered on 22 Jul 2010, 01:44 PM
Hi,
       Any suggetions?

-Thanks
0
Daniel
Telerik team
answered on 26 Jul 2010, 10:49 AM
Hello John,

Please download the attached demo and let me know whether this helps.

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
Tags
Grid
Asked by
Chandran Chandran
Top achievements
Rank 1
Answers by
Chandran Chandran
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or