We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Exporting aggregate footer during excel/pdf export

Thread ID:

Created:

Updated:

Platform:

Replies:

151023 Jan 28,2020 01:36 PM UTC Jan 29,2020 10:10 AM UTC Angular - EJ 2 1
loading
Tags: Grid
Ankit Pathak
Asked On January 28, 2020 01:36 PM UTC

Hi,

I am using Grid in my Angular 8 project.

I want to :

          1) export aggregate footer during excel/pdf export, because currently I get only Grid Data(not footer) during excel/pdf export.
          2) Apply outer border on excel data.

Please suggest any way to do that.

Thanks & Regards,
Ankit Pathak

Balaji Sekar [Syncfusion]
Replied On January 29, 2020 10:10 AM UTC

Hi Ankit, 
 
Thanks for contacting us. 
 
Query#1: export aggregate footer during excel/pdf export, because currently I get only Grid Data(not footer) during excel/pdf export. 
 
we suggest you to use the TypeScript way of rendering the aggregates in Grid(as suggested in the below code example), Since angular Ng-template has some technical limitation while compiling the Ng-template. 
 
[App.component.html] 
<div class="control-section"> 
    <ejs-grid #grid [dataSource]='data' allowPaging='true' height=375 [pageSettings]='pageSettings' [aggregates]='aggreagtes'  [toolbar]='toolbar' (toolbarClick)='toolbarClick($event)' 
                [allowExcelExport]='true' [allowPdfExport]='true'> 
. . . 
    </ejs-grid> 
</div> 

[App.component.ts] 
. . . 
export class AppComponent { 
    public data: Object[]; 
    public toolbar: string[]; 
    public pageSettings: Object; 
    public aggreagtes: Object; 
    @ViewChild('grid', {statictrue}) 
    public grid: GridComponent; 
 
    public ngOnInit(): void { 
        this.data = orderDetails; 
        this.toolbar = ['ExcelExport''PdfExport''CsvExport']; 
        this.pageSettings = { pageCount: 5 }; 
        this.aggreagtes = [{ 
            columns: [{ 
                type'Sum', 
                field: 'Freight', 
                format: 'N2', 
                footerTemplate: 'Sum: ${Sum}' 
            }] 
        }]; 
    } 
    } 
} 
 
 
 
Query#2: Apply outer border on excel data. 
 
You can apply the border for excel data using excelQueryCellInfo event of the Grid, which triggers for each cell of the excel export file. Please refer the below code example and sample for more information. 
 
[App.component.html] 
<div class="control-section"> 
    <ejs-grid #grid [dataSource]='data' allowPaging='true' (excelQueryCellInfo)="excelQueryCellInfo($event)" height=375 [pageSettings]='pageSettings' [aggregates]='aggreagtes'  [toolbar]='toolbar' (toolbarClick)='toolbarClick($event)' 
                [allowExcelExport]='true' [allowPdfExport]='true'> 
. . . 
    </ejs-grid> 
</div> 

[App.component.ts] 
. . . 
@Component({ 
    selector: 'app-root', 
    templateUrl: 'app.component.html', 
    providers: [ToolbarServicePageServiceExcelExportServicePdfExportServiceGroupService] 
 
}) 
export class AppComponent { 
    public data: Object[]; 
    public toolbar: string[]; 
    public pageSettings: Object; 
    public aggreagtes: Object; 
    @ViewChild('grid', {statictrue}) 
    public grid: GridComponent; 
 
    public ngOnInit(): void { 
        this.data = orderDetails; 
        this.toolbar = ['ExcelExport''PdfExport''CsvExport']; 
        this.pageSettings = { pageCount: 5 }; 
        this.aggreagtes = [{ 
            columns: [{ 
                type'Sum', 
                field: 'Freight', 
                format: 'N2', 
                footerTemplate: 'Sum: ${Sum}' 
            }] 
        }]; 
    } 
  excelQueryCellInfo(args) { 
// applying the color and border color for  
    args.style = {borders: { color: '#9c4b4b' }, fontColor: '#9c4b4b' }; 
  } 
. . . 
} 
 
 
Please get back to us, if you need further assistance. 
 
Regards, 
Balaji Sekar. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon