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.
Unfortunately, activation email could not send to your email. Please try again.

How to export Grid to Word, Excel and PDF in JavaScript?

You can export ejGrid from the HTML file by using the Export function. However for exporting, you need some server-side services. Used here is the WebAPI and the provided code example related to it for exporting the Grid to Excel, Word and PDF. In the code example provided toolbarClick event is used to call the Export method in the WebAPI controller.

HTML

Controller

Server Side Dependencies:

Export helper functions are available in the Assembly Syncfusion.EJ.Export which are needed for exporting of the Grid. Full list of assemblies needed for the Grid export are as follows.

  1. Syncfusion.EJ
  2. Syncfusion.EJ.Export
  3. Syncfusion.Compression.Base
  4. Syncfusion.Linq.Base
  5. Syncfusion.DocIO.Base
  6. Syncfusion.XlsIO.Base
  7. Syncfusion.PDF.Base

Parameter used in excel export method

Parameter

Type

Defination

  1. gridmodel

GridProperties

Add the grid collection to export

  1. datasource

IEnumerable

Include the grid data source

  1. excelname

string

To set the excel file name

  1. excelversion

ExcelVersion

To set the machine supported version to excel

  1. isHideColumnIncude

bool

To show or hide the visible false column

  1. isTemplateColumnIclude

bool

To show the template column in export method

  1. theme

string

To set the required theme to grid

  1. multipleExport

bool

To enable multiple exporting

  1. workBook

IWorkbook

Open existing file or create new file

  1.  exportType

MultipleExportType

To export in multiple sheet

  1. headerText

string

To set the title to grid

Parameter used in word export method

Parameter

Type

Defination

  1. gridmodel

GridProperties

Add the grid collection to export

  1. datasource

IEnumerable

Include the grid data source

  1. fileName

string

To set the word file name

  1. isHideColumnIncude

bool

To show or hide the visible false column

  1. isTemplateColumnIclude

bool

To show the template column in export method

  1. theme

string

To set the required theme to grid

  1. multipleExport

bool

To enable multiple exporting

  1. document

IWordDocument

Open existing file or create new file

  1. headerText

string

To set the title to grid

Parameter used in PDF export method

Parameter

Type

Defination

  1. gridmodel

GridProperties

Add the grid collection to export

  1. datasource

IEnumerable

Include the grid data source

  1. fileName

string

To set the excel file name

  1. isHideColumnIncude

bool

To show or hide the visible false column

  1. isTemplateColumnIclude

bool

To show the template column in export method

  1. theme

string

To set the required theme to grid

  1. multipleExport

bool

To enable multiple exporting

  1. document

PdfDocument

Open existing file or create new file

  1. headerText

string

To set the title to grid

Result

Exported gridFigure 1: Output

Article ID: Published Date: Last Revised Date: Platform: Control:
4487 04/19/2015 09/19/2018 JavaScript ejGrid
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.