Unplanned
Last Updated: 06 Feb 2024 12:56 by ADMIN
Paul Dell
Created on: 13 Aug 2019 12:27
Category: GridView
Type: Feature Request
1
Spread export with child rows collapsed
Hello, i am using the GridViewSpreadStreamExport to export a gridview with parent and child rows.
Everithing works fine but is it possible to set the parent row to collapsed, if there are child rows?
2 comments
ADMIN
Nadya | Tech Support Engineer
Posted on: 06 Feb 2024 12:56

Hello, Paul,

I would like to follow up on this case. If you want, you can use the following workaround until the feature request is introduced. 

private void radButton1_Click(object sender, EventArgs e)
{
    GridViewSpreadExport export = new GridViewSpreadExport(this.radGridView1);
    export.ExportChildRowsGrouped = true;
    export.ExportVisualSettings = true;
    export.ExportHierarchy = true;
    var renderer = new SpreadExportRenderer();
    renderer.WorkbookCreated += this.Renderer_WorkbookCreated;
    export.RunExport(@"..\..\Exported\spreadsheet" + DateTime.Now.ToString("HH-mm-ss"), renderer);
}
 
private void Renderer_WorkbookCreated(object sender, WorkbookCreatedEventArgs e)
{
    var worksheet = e.Workbook.Worksheets[0];
    CellRange usedCellRange = worksheet.UsedCellRange;
    for (int rowIndex = usedCellRange.FromIndex.RowIndex; rowIndex <= usedCellRange.ToIndex.RowIndex; rowIndex++)
    {
        RangePropertyValue<int> outlineLevelRangeValue = worksheet.Rows[rowIndex].GetOutlineLevel();
        int outLineLevel = outlineLevelRangeValue.Value;
        if (outLineLevel > 0)
        {
            RowSelection rowSelection = worksheet.Rows[rowIndex];
            rowSelection.SetHidden(true);
        }
    }
}

As result the grid is exported with collapsed rows:

I hope this helps. Should you have other questions do not hesitate to contact us.

Regards,
Nadya | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 14 Aug 2019 07:25
Hello, Tel, 

Note that if you want to eliminate the child rows in the exported file, you can set the GridViewSpreadStreamExport.ExportHierarchy property to false. Thus, only the parent rows will be visible in the exported file. 

However, if you export the hierarchy when the ExportChildRowsGrouped property is enabled, the +/- sign appears in front of each row. By default, all rows are expanded. Note that the GridViewSpreadStreamExport and GridViewSpreadExport use internally RadSpreadStreamProcessing and RadSpreadProcessing libraries. Currently, there is no appropriate public API for collapsing/expanding the grouped child rows in the document processing libraries. That is why the grid exports doesn't offer such functionality.

It sounds to be a reasonable feature request. I have logged it in our feedback portal by making this thread public. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.