How to set outline according to grouped data generated by smart markers

By using smart markers I can group data as I wish in the grid.
For exmpale, this is how my app exported

image.png (20.2 KB)

But I want the exported worksheet has outline as shown below
image.png (21.1 KB)

I can achieve this by introducing “depth” and “childCount” columns into the datatable and thus I can figure out which rows to be grouped.

I’m just wondering if it is possible to achieve this from smart markers itself by using parameters.

My app is being attached , please check.
ExportTemplateTool - Group Issue 3.zip (300.9 KB)

@mchen11

Thanks for using Aspose APIs.

Once, you populate your template (smart marker) Excel file with data, then you will have to create outline (or grouping) by yourself with your own algorithm.

Please see the following sample code, its sample input and output Excel files, comments and screenshot. Please write the similar algorithm by yourself to achieve your requirements.

Download Link:
Input and Output Excel Files.zip (12.0 KB)

C#

//Load the sample workbook
Workbook wb = new Workbook("sample.xlsx");

//Access first worksheet
Worksheet ws = wb.Worksheets[0];

//Fill the list with non-blank cells
List<Cell> colCells = new List<Cell>();
Cell endCell = ws.Cells.EndCellInColumn(0);

for(int i=1; i<=endCell.Row; i++)
{
    Cell c = ws.Cells[i, 0];

    if (c.Type == CellValueType.IsNull)
        continue;

    colCells.Add(c);
}

//Please do this in loop - this is just an example
ws.Cells.GroupRows(colCells[0].Row, colCells[1].Row -2);
ws.Cells.GroupRows(colCells[1].Row, colCells[2].Row -2 );
ws.Cells.GroupRows(colCells[2].Row, colCells[3].Row -2);

//Save the workbook
wb.Save("output.xlsx");

Screenshot:

Thank you for the prompt reply and yes that’s exactly what I did for now.