Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
435
Grouping in Excel Engine
posted

Hi,

I am not sure where to add this post it is for the Excel engine.

I want to be able to group/collapse data in Excel after I export it using in a worksheet. I want a functionality similar to  Data  > Group and Outline > Group.

Is there a built in function in the Excel engine. If yes please send me a link to a code sample.

Thanks, Jayson 

  • 29065
    Suggested Answer
    Offline posted

    Hello Jayson,

    Yes, our Infragistics Excel engine supports hierarchical grouping of rows and columns with via outline levels. I attached a sample that exports a grid to excel and handles the

    UltraGridExcelExporter1_RowExporting to manipulate the worksheet rows to specific outline levels. When the excel file is opened you will see the group area appear to the left of the rows with collapse/expand indicators.

    Quote from your docs:

    "Microsoft Excel supports hierarchical grouping of rows and columns with a maximum of seven levels of hierarchy. To create a group, set adjacent rows or columns to same outline level. When rows or columns are grouped, an outline indicator will provide a visual representation of the outline level. In addition, an outline group has an expansion indicator at one end of the group, which allows the user to easily hide and unhide all rows or column in the group with a single click."

            e.CurrentWorksheet.Rows(1).OutlineLevel = 1         e.CurrentWorksheet.Rows(2).OutlineLevel = 1

            e.CurrentWorksheet.Rows(3).OutlineLevel = 2         e.CurrentWorksheet.Rows(3).OutlineLevel = 2

            e.CurrentWorksheet.Rows(5).OutlineLevel = 3         e.CurrentWorksheet.Rows(6).OutlineLevel = 3  

    Please see my sample attached for more details.

    ExportGrid.zip