Export to Excel from angular TreeList in a grid style instead of hierarchical style

1 Answer 23 Views
Excel Export Spreadsheet TreeList
Kyle
Top achievements
Rank 1
Iron
Kyle asked on 26 Feb 2024, 09:58 PM

Hey guys,

I have an angular form that contains two tree lists: the first one is hierarchal and the 2nd is flat.  Both are populated using [kendoTreeListFlagBinding] and both render correctly.  The first tree list is hierarchal and the second is flat.  Yay Kendo!!

The issue is when I go to export from the flat treelist, it exports hierarchal and not flat.

First Treelist

 <kendo-treelist
            *ngIf="!this.isFlatList"
            [kendoTreeListFlatBinding]="ssAllowances"
            filterable="menu"
            [filter]="filter"
            (filterChange)="this.setFilter($event)"
            [sortable]="{ mode: 'multiple' }"
            [sort]="sort"
            kendoTreeListExpandable
            idField = 'currentGUID'  
            parentIdField='parentGUID'
            >
            <ng-template kendoTreeListToolbarTemplate>
              <button look="flat" type="button" class="btn"
                      title="Export to Excel" kendoTreeListExcelCommand>
                <i class="fa fa-lg fa-file-excel-o"></i>
              </button>
            </ng-template>

code for the column defs etc

 

second Treelist

 <kendo-treelist-column
              *ngIf="this.canDeleteAllowance()"
              width="25">
              <ng-template kendoTreeListCellTemplate let-dataItem #deleteButtonTemplate>
                <a *ngIf="dataItem.canDelete && dataItem.allowanceId !== 0"
                (click)="deleteAllowance(dataItem)"
                title="CLick to Delete">
                <i class="fa fa-trash"></i></a>
              </ng-template>
            </kendo-treelist-column>
            <kendo-treelist-excel fileName="ShipsetAllowances.xlsx"></kendo-treelist-excel>
          </kendo-treelist>

code for the column defs etc

 

What I need is the "directive" to tell excel to export the data as a flat list.

What am I missing from the doc

 

Thanx Kyle

 

 

Georgi
Telerik team
commented on 29 Feb 2024, 01:42 PM

Hello Kyle,

Thank you very much for the code snippets provided.

From what I understood from your question, you are currently utilizing two instances of the Kendo UI for Angular TreeList both using the FlatBindingDirective - one is displaying hierarchical data and the other is displaying flat data. However, you are experiencing issues with the Excel Export functionality such that only the TreeList component with hierarchical data is being exported. Please, let me know if I misunderstood you.

Based on the information provided in the thread, I tried reproducing the issue with the Excel Export functionality. However, it seems like I might be missing out on some of the reproduction steps since the component behaves according to the expectations on my side. Here is the StackBlitz demo where I performed the testing:

https://stackblitz.com/edit/angular-ec4by1

In order to avoid misunderstandings, I would ask you to provide more detailed information about the specifics of the implementation or ideally a small runnable example demonstrating the issues. This would allow me to reproduce it on my side and thus come up with a more case-specific suggestion. 

In the meantime, I would suggest checking out the following article that might prove to be useful for the particular case:

https://www.telerik.com/kendo-angular-ui/components/treelist/export/excel-export/

Please, let me know if I am missing out on something.

Regards,
Georgi
Progress Telerik
Kyle
Top achievements
Rank 1
Iron
commented on 29 Feb 2024, 06:20 PM

Thank you for getting back to me, Georgi.  The issue is when exporting from the Tree list while I have it set to display data in "list" mode, not Hierarchical mode, The excel file is formatted in hierarchical style.  I need it flat like the tree list.  An example would be when I export from the  Kendo grid, it's not indented, column A holds the "root" data.

I have attached two files

Hierarchial.xlsx is exported from the Treelist in Hierarchical mode
List.xlsx is exported from the grid component and it's flat.

I would like to know if the Treelist supports exporting the data flat?

Georgi
Telerik team
commented on 05 Mar 2024, 11:03 AM

Hi Kyle,

Thank you very much for the clarifications provided.

From what I understood from the additional details in the question, you are trying to export the data inside a flat Kendo UI for Angular TreeList component to Excel but are getting the data in a hierarchical format in the exported file. Please, let me know if I misinterpreted the issue that you are experiencing.

I tested the Excel Export functionality of the TreeList component using a similar configuration but it seems that I am still missing some of the reproduction steps since the component exports both hierarchical and flat data according to the expectations - hierarchical data in hierarchical format and flat data in flat format. Here is the StackBlitz demo where I performed the testing:

https://stackblitz.com/edit/angular-ec4by1-tqcdfa

Attached, I am also sending you the exported Excel files from the two TreeList components.

Since I am not entirely sure what is the exact desired end goal, I am sending you a StackBlitz demo that demonstrates a possible approach for exporting hierarchical data in flat format:

https://stackblitz.com/edit/angular-zeibzk

In case the provided information and examples do not help you achieve the desired functionality, I would ask you to provide a runnable example demonstrating the exact issue as well as a more detailed explanation of the desired behavior. This would allow me to gain a better understanding of the exact scenario and thus come up with suggestions that are more relevant to the specific case.

Let me know if this helps.

Regards,
Georgi
Progress Telerik
Kyle
Top achievements
Rank 1
Iron
commented on 05 Mar 2024, 06:44 PM

Georgi,

You nailed it.  is it as simple as removing the parentIdField=managerid" ???

1 Answer, 1 is accepted

Sort by
0
Kyle
Top achievements
Rank 1
Iron
answered on 05 Mar 2024, 06:51 PM

Georgi

You are the man!  worked like a charm!  I appreciate your help!

 

Kyle

Tags
Excel Export Spreadsheet TreeList
Asked by
Kyle
Top achievements
Rank 1
Iron
Answers by
Kyle
Top achievements
Rank 1
Iron
Share this question
or