Completed
Last Updated: 15 Oct 2015 11:50 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 14 Oct 2015 12:57
Category: GridView
Type: Bug Report
1
FIX. RadGridView - GridViewSpreadExport displays summary rows outside their groups when the group is collapsed in Excel.
To reproduce: 

private void Form1_Load(object sender, EventArgs e)
{ 
    this.productsTableAdapter.Fill(this.nwindDataSet.Products);
    this.radGridView1.DataSource = this.productsBindingSource;
    GridViewSummaryItem summaryItem = new GridViewSummaryItem();
    summaryItem.Name = "UnitPrice";
    summaryItem.Aggregate = GridAggregateFunction.Count;
    GridViewSummaryRowItem summaryRowItem = new GridViewSummaryRowItem();
    summaryRowItem.Add(summaryItem);
    this.radGridView1.SummaryRowsTop.Add(summaryRowItem);
    
    GroupDescriptor descriptor1 = new GroupDescriptor();
    descriptor1.GroupNames.Add("CategoryID", ListSortDirection.Ascending);
    this.radGridView1.GroupDescriptors.Add(descriptor1);
    GroupDescriptor descriptor11 = new GroupDescriptor();
    descriptor11.GroupNames.Add("SupplierID", ListSortDirection.Ascending);
    this.radGridView1.GroupDescriptors.Add(descriptor11);
    GroupDescriptor descriptor2 = new GroupDescriptor();
    descriptor2.GroupNames.Add("QuantityPerUnit", ListSortDirection.Ascending);
    descriptor2.GroupNames.Add("UnitsInStock", ListSortDirection.Ascending);
    this.radGridView1.GroupDescriptors.Add(descriptor2);
    GroupDescriptor descriptor3 = new GroupDescriptor();
    descriptor3.GroupNames.Add("UnitsOnOrder", ListSortDirection.Ascending);
    descriptor3.GroupNames.Add("ReorderLevel", ListSortDirection.Descending);
    this.radGridView1.GroupDescriptors.Add(descriptor3);
    GroupDescriptor descriptor4 = new GroupDescriptor();
    descriptor4.GroupNames.Add("Discontinued", ListSortDirection.Ascending);
    this.radGridView1.GroupDescriptors.Add(descriptor4);
}

private void radButton1_Click(object sender, EventArgs e)
{
    GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.radGridView1);
    SpreadExportRenderer exportRenderer = new SpreadExportRenderer();
    string filePath = @"..\..\exported" + DateTime.Now.ToShortTimeString().Replace(":", "_") + ".xlsx";
    spreadExporter.ExportGroupedColumns = true;
    spreadExporter.ExportChildRowsGrouped = true;
     spreadExporter.HiddenColumnOption = Telerik.WinControls.UI.Export.HiddenOption.DoNotExport;
    spreadExporter.ExportVisualSettings = true;
    spreadExporter.SummariesExportOption = Telerik.WinControls.UI.Export.SummariesOption.ExportAll;
    spreadExporter.RunExport(filePath, exportRenderer);

    Process.Start(filePath);
}


Workaround: set the ExportChildRowsGrouped property to false.
0 comments