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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Export To Excel using API

Thread ID:





140996 Nov 18,2018 07:11 AM UTC Nov 23,2018 12:15 PM UTC Angular 5
Tags: ejGrid
Asked On November 18, 2018 07:11 AM UTC

Hi Team,

 Very Urgent Request.

 I am using EJ1 Controls for my project with angular 4 with typescript and ASp.net core Web api .

In That , I have scenerio for export to excel of grid visible and hide columns using API .

Please give some samples on this.

Divakaran N

Replied On November 19, 2018 05:49 AM UTC

Hi team ,

Any update on my request .
Please give solution asap.

Divakaran N

Manivannan Padmanaban [Syncfusion]
Replied On November 21, 2018 03:06 AM UTC

Hi Divakaran, 

Thanks for contacting syncfusion support. We are happy to assist you. 

We have achieve your requirement. Please refer the below code example and sample link. 

<ej-grid id="Grid" #Grid  [allowPaging]="true"  [dataSource]="data" [toolbarSettings]="toolbarSettings" (toolbarClick)="toolbar($event)" > 

export class PlanningComponent { 
    @ViewChild('Grid') Grid: EJComponents<any, any>; 
     toolbar(e: any) { 
        if (e.itemName == "Excel Export") { 
            e.cancel = true; 
        else if (e.itemName == "Word Export") { 
            e.cancel = true;//prevent the default action 
        else if (e.itemName == "PDF Export") { 
            e.cancel = true; 

// Controller Page 

        public IActionResult ExcelExport(string GridModel) 
            ExcelExport exp = new ExcelExport(); 
            var DataSource = order; 
            GridProperties gridProperty = ConvertGridObject(GridModel); 
            GridExcelExport excelExp = new GridExcelExport(); 
            excelExp.FileName = "Export.xlsx"; excelExp.Excelversion = ExcelVersion.Excel2010; 
            excelExp.Theme = "flat-saffron"; 
            return exp.Export(gridProperty, DataSource, excelExp); 
        //Word Export Method. 
        public IActionResult WordExport(string GridModel) 
            var DataSource = order; 
            WordExport exp = new WordExport(); 
            GridProperties gridProperty = ConvertGridObject(GridModel); 
            GridWordExport wordExp = new GridWordExport(); 
            wordExp.FileName = "Export.docx"; 
            wordExp.Theme = "flat-saffron"; 
            return exp.Export(gridProperty, DataSource, wordExp); 
        //PDF Export Method. 
        public IActionResult PdfExport(string GridModel) 
            var DataSource = order; 
            PdfExport exp = new PdfExport(); 
            GridProperties gridProperty = ConvertGridObject(GridModel); 
            GridPdfExport pdfexp = new GridPdfExport(); 
            pdfexp.FileName = "Export.pdf"; 
            pdfexp.Theme = "flat-saffron"; 
            return exp.Export(gridProperty, DataSource, pdfexp); 
        public GridProperties ConvertGridObject(string gridProperty) 
            GridProperties gridProp = new GridProperties(); 
            gridProp = (GridProperties)JsonConvert.DeserializeObject(gridProperty, typeof(GridProperties)); 
            return gridProp; 

Manivannan Padmanaban. 

Gangabharathy Murugasen [Syncfusion]
Replied On November 21, 2018 04:41 AM UTC

From: Nagappan, Divakaran  
Hi Syncfusion, 

For a past two days i was waiting for your reply but not yet got any reply from your side. 

Please check and give some Suggesion otherwise i dont have any option other than escalation. 
Thanks & Regards, 
Divakaran N 

Muthukumar Periasamy
Replied On November 22, 2018 09:12 AM UTC

Hi Manivannan,

     Thanks for your support.

      I was trying with your solution but i don't know how to add syncfusion dll in WebApi.

    Your are sharing the examples with MVC project but i am having WebAPI . 

   Please Help me on this.

Divakaran N

Vignesh Natarajan [Syncfusion]
Replied On November 23, 2018 12:15 PM UTC

Hi Divakaran, 

Thanks for the update. 

Query1:   I was trying with your solution but i don't know how to add Syncfusion dll in WebApi. 

You can find the Syncfusion assemblies (dll reference) in the below location of your installed folder 

Location: Installed location\Syncfusion\Essential Studio\\Assemblies\Frame work version. 
We can also get the dll from the nuget packages. Please do refer the below help documentation link, 

Query2:     You are sharing the examples with MVC project but i am having WebAPI .  
The sample which we provided in the last update is Angular-webAPI in Asp.netCore  project only. If you are facing any difficulties while implementing the solution. 

Please get back to us with following details. 

  1. Share the Error screenshot.
  2. Share the issue are you facing in detail.

Vignesh Natarajan 


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