- Home
- Forum
- Angular - EJ 2
- Export Excel Not Working With row template
Export Excel Not Working With row template
Hi I would like to know about the export excel that I used in my project. in my treegrid I used row template to customize field in the column but When I Export It isn't show anything in the excel. Here is my Code :
<a (click)="exportTable()" class="btn btn-success">Export Excel a>
<ejs-treegrid (excelExportComplete)='excelExportComplete($event)' [allowExcelExport]='true' [allowPdfExport]='true' #treegrid [dataSource]='allData' height='550' [treeColumnIndex]='0' rowHeight='35' childMapping='child_detail' [searchSettings]='searchSettings' [toolbar]='toolbar'>
<e-columns>
<e-column width="90%">
<ng-template #headerTemplate>
<div class="header-table-text info bold"> Name div>
>
<ng-template #template let-data>
<span *ngIf="data != null">{{data.id}} -- {{data.name}}
>
>
>
<e-column width="10%">
<ng-template #headerTemplate >
<div class="info bold custom-inline"> Gender div>
>
<ng-template #template let-data>
<span *ngIf="data != null">{{data.gender}}
>
>
>
>
>
SIGN IN To post a reply.
5 Replies
FS
Farveen Sulthana Thameeztheen Basha
Syncfusion Team
January 5, 2021 04:27 PM UTC
Hi kimheng,
Thanks for contacting Syncfusion Support.
Query#:- When I Export It isn't show anything in the excel.
From your query you understood that you need to perform Exporting with Template column. In EJ2 TreeGrid, currently we do not have support for “Exporting Treegrid with column Template”.
We have planned to implement and include this feature improvement in any of our upcoming release. At the planning stage for every release cycle, we review all open features. We will let you know when this feature is implemented. The status of implementation can be tracked through our Features Management System.
We have planned to implement and include this feature improvement in any of our upcoming release. At the planning stage for every release cycle, we review all open features. We will let you know when this feature is implemented. The status of implementation can be tracked through our Features Management System.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
Feedback Link : : https://www.syncfusion.com/feedback/10384/need-to-provide-support-for-exporting-grid-with-column-template-and-detail
Please get back to us if you need any further assistance.
Regards,
Farveen sulthana T
KI
kimheng
January 6, 2021 02:24 AM UTC
Oh... So is there any way I can do to get 2 Fields in one column without using template ? Example :
<e-column field='id , name' headerText='Title' width=70></e-column>
FS
Farveen Sulthana Thameeztheen Basha
Syncfusion Team
January 6, 2021 04:10 PM UTC
Hi kimheng,
Query#:- So is there any way I can do to get 2 Fields in one column without using template ?
Instead of Template, we have the option to display the multiple columns values in single column using ValueAccessor property of the TreeGrid column. The valueAccessor is used to access/manipulate the value of display data. Also we can Excel export the same with multiple column values in single column while using valueAccessor.
Refer to the code below:-
|
App.Component.html
<ejs-treegrid #treegrid [dataSource]='data' height='400' childMapping='subtasks' [treeColumnIndex]='1'[toolbar]='toolbar' (toolbarClick)='toolbarClick($event)' allowExcelExport='true' allowPdfExport='true'>
<e-columns>
<e-column field='duration' [valueAccessor]='currencyFormatter' headerText='Duration' width='80'
textAlign='Right'></e-column>
. . .
</e-columns>
</ejs-treegrid>
App.Component.ts
export class AppComponent {
public data: Object[] = [];
public toolbar: string[];
@ViewChild('treegrid')
public treegrid: TreeGridComponent;
ngOnInit(): void {
this.data = sampleData;
this.toolbar = ['ExcelExport', 'PdfExport', 'CsvExport'];
}
currencyFormatter(field: string, data: Object, column: Object): string {
return data[field] + "," + data['progress'];
}
}
|
Note:- We cannot use 2 Field values with Field property as like provided in your code. Because all TreeGrid actions has been performed based on Field property.
Sample Link with Exporting:- https://stackblitz.com/edit/angular-sk4o15-ma6hm8
Screenshot:-
Refer to the documentation Link:-
Please get back to us if you need any further assistance.
Regards,
Farveen sulthana T
KI
kimheng
January 18, 2021 03:19 AM UTC
Omg this is what I'm looking for... Thank you so much for your reply.
FS
Farveen Sulthana Thameeztheen Basha
Syncfusion Team
January 19, 2021 04:52 AM UTC
Hi kimheng,
Thanks for your update. Please get back to us if you need any further assistance. We are happy to assist you.
Regards,
Farveen sulthana T
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
KI kimheng
- Jan 4, 2021 08:54 AM UTC
- Jan 19, 2021 04:52 AM UTC