The excel export allows exporting Grid data to Excel document. You need to use the
excelExport
method for exporting. To enable Excel export in the grid, set the
allowExcelExport
as true.
To use excel export, inject ExcelExport module in the provide section.
<template>
<div id="app">
<ejs-grid ref='grid' id='Grid' :dataSource='data' :toolbar='toolbarOptions' height='272px' :allowExcelExport='true' :toolbarClick='toolbarClick'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='ShipCity' headerText='Ship City' width=150></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, Toolbar, ExcelExport } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
Vue.use(GridPlugin);
export default {
data() {
return {
data: data,
toolbarOptions: ['ExcelExport']
};
},
methods: {
toolbarClick: function(args) {
if (args.item.id === 'Grid_excelexport') { // 'Grid_excelexport' -> Grid component id + _ + toolbar item name
this.$refs.grid.excelExport();
}
}
},
provide: {
grid: [Toolbar, ExcelExport]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";
</style>
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.data = [
{
"OrderID":10248,
"CustomerID":"VINET",
"OrderDate":"1996-07-04T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":32.38,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10249,
"CustomerID":"TOMSP",
"OrderDate":"1996-07-05T00:00:00.000Z",
"ShippedDate":"1996-07-10T00:00:00.000Z",
"Freight":11.61,
"ShipName":"Toms Spezialitäten",
"ShipAddress":"Luisenstr. 48",
"ShipCity":"Münster",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10250,
"CustomerID":"HANAR",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-12T00:00:00.000Z",
"Freight":65.83,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10251,
"CustomerID":"VICTE",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":41.34,
"ShipName":"Victuailles en stock",
"ShipAddress":"2, rue du Commerce",
"ShipCity":"Lyon",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10252,
"CustomerID":"SUPRD",
"OrderDate":"1996-07-09T00:00:00.000Z",
"ShippedDate":"1996-07-11T00:00:00.000Z",
"Freight":51.3,
"ShipName":"Suprêmes délices",
"ShipAddress":"Boulevard Tirou, 255",
"ShipCity":"Charleroi",
"ShipRegion":null,
"ShipCountry":"Belgium"
},
{
"OrderID":10253,
"CustomerID":"HANAR",
"OrderDate":"1996-07-10T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":58.17,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10254,
"CustomerID":"CHOPS",
"OrderDate":"1996-07-11T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":22.98,
"ShipName":"Chop-suey Chinese",
"ShipAddress":"Hauptstr. 31",
"ShipCity":"Bern",
"ShipRegion":null,
"ShipCountry":"Switzerland",
"Verified": true
},
{
"OrderID":10255,
"CustomerID":"RICSU",
"OrderDate":"1996-07-12T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":148.33,
"ShipName":"Richter Supermarkt",
"ShipAddress":"Starenweg 5",
"ShipCity":"Genève",
"ShipRegion":null,
"ShipCountry":"Switzerland"
},
{
"OrderID":10256,
"CustomerID":"WELLI",
"OrderDate":"1996-07-15T00:00:00.000Z",
"ShippedDate":"1996-07-17T00:00:00.000Z",
"Freight":13.97,
"ShipName":"Wellington Importadora",
"ShipAddress":"Rua do Mercado, 12",
"ShipCity":"Resende",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10257,
"CustomerID":"HILAA",
"OrderDate":"1996-07-16T00:00:00.000Z",
"ShippedDate":"1996-07-22T00:00:00.000Z",
"Freight":81.91,
"ShipName":"HILARION-Abastos",
"ShipAddress":"Carrera 22 con Ave. Carlos Soublette #8-35",
"ShipCity":"San Cristóbal",
"ShipRegion":"Táchira",
"ShipCountry":"Venezuela"
},
{
"OrderID":10258,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-17T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":140.51,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"ShipCountry":"Austria"
},
{
"OrderID":10259,
"CustomerID":"CENTC",
"OrderDate":"1996-07-18T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":3.25,
"ShipName":"Centro comercial Moctezuma",
"ShipAddress":"Sierras de Granada 9993",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico",
"Verified": true
},
{
"OrderID":10260,
"CustomerID":"OTTIK",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-29T00:00:00.000Z",
"Freight":55.09,
"ShipName":"Ottilies Käseladen",
"ShipAddress":"Mehrheimerstr. 369",
"ShipCity":"Köln",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10261,
"CustomerID":"QUEDE",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-30T00:00:00.000Z",
"Freight":3.05,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10262,
"CustomerID":"RATTC",
"OrderDate":"1996-07-22T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":48.29,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA",
"Verified": true
},
{
"OrderID":10263,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-23T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":146.06,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"Verified": true,
"ShipCountry":"Austria"
},
{
"OrderID":10264,
"CustomerID":"FOLKO",
"OrderDate":"1996-07-24T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":3.67,
"ShipName":"Folk och fä HB",
"ShipAddress":"Åkergatan 24",
"ShipCity":"Bräcke",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10265,
"CustomerID":"BLONP",
"OrderDate":"1996-07-25T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":55.28,
"ShipName":"Blondel père et fils",
"ShipAddress":"24, place Kléber",
"ShipCity":"Strasbourg",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10266,
"CustomerID":"WARTH",
"OrderDate":"1996-07-26T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":25.73,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10267,
"CustomerID":"FRANK",
"OrderDate":"1996-07-29T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":208.58,
"ShipName":"Frankenversand",
"ShipAddress":"Berliner Platz 43",
"ShipCity":"München",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10268,
"CustomerID":"GROSR",
"OrderDate":"1996-07-30T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":66.29,
"ShipName":"GROSELLA-Restaurante",
"ShipAddress":"5ª Ave. Los Palos Grandes",
"ShipCity":"Caracas",
"ShipRegion":"DF",
"ShipCountry":"Venezuela"
},
{
"OrderID":10269,
"CustomerID":"WHITC",
"OrderDate":"1996-07-31T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":4.56,
"ShipName":"White Clover Markets",
"ShipAddress":"1029 - 12th Ave. S.",
"ShipCity":"Seattle",
"ShipRegion":"WA",
"ShipCountry":"USA"
},
{
"OrderID":10270,
"CustomerID":"WARTH",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":136.54,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10271,
"CustomerID":"SPLIR",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":4.54,
"ShipName":"Split Rail Beer & Ale",
"ShipAddress":"P.O. Box 555",
"ShipCity":"Lander",
"ShipRegion":"WY",
"ShipCountry":"USA"
},
{
"OrderID":10272,
"CustomerID":"RATTC",
"OrderDate":"1996-08-02T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":98.03,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
},
{
"OrderID":10273,
"CustomerID":"QUICK",
"OrderDate":"1996-08-05T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":76.07,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10274,
"CustomerID":"VINET",
"OrderDate":"1996-08-06T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":6.01,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10275,
"CustomerID":"MAGAA",
"OrderDate":"1996-08-07T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":26.93,
"ShipName":"Magazzini Alimentari Riuniti",
"ShipAddress":"Via Ludovico il Moro 22",
"ShipCity":"Bergamo",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10276,
"CustomerID":"TORTU",
"OrderDate":"1996-08-08T00:00:00.000Z",
"ShippedDate":"1996-08-14T00:00:00.000Z",
"Freight":13.84,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10277,
"CustomerID":"MORGK",
"OrderDate":"1996-08-09T00:00:00.000Z",
"ShippedDate":"1996-08-13T00:00:00.000Z",
"Freight":125.77,
"ShipName":"Morgenstern Gesundkost",
"ShipAddress":"Heerstr. 22",
"ShipCity":"Leipzig",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10278,
"CustomerID":"BERGS",
"OrderDate":"1996-08-12T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":92.69,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10279,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-13T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":25.83,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10280,
"CustomerID":"BERGS",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-09-12T00:00:00.000Z",
"Freight":8.98,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden",
"Verified": true
},
{
"OrderID":10281,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":2.94,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10282,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-15T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":12.69,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10283,
"CustomerID":"LILAS",
"OrderDate":"1996-08-16T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":84.81,
"ShipName":"LILA-Supermercado",
"ShipAddress":"Carrera 52 con Ave. Bolívar #65-98 Llano Largo",
"ShipCity":"Barquisimeto",
"ShipRegion":"Lara",
"ShipCountry":"Venezuela"
},
{
"OrderID":10284,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-19T00:00:00.000Z",
"ShippedDate":"1996-08-27T00:00:00.000Z",
"Freight":76.56,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10285,
"CustomerID":"QUICK",
"OrderDate":"1996-08-20T00:00:00.000Z",
"ShippedDate":"1996-08-26T00:00:00.000Z",
"Freight":76.83,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10286,
"CustomerID":"QUICK",
"OrderDate":"1996-08-21T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":229.24,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10287,
"CustomerID":"RICAR",
"OrderDate":"1996-08-22T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":12.76,
"ShipName":"Ricardo Adocicados",
"ShipAddress":"Av. Copacabana, 267",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10288,
"CustomerID":"REGGC",
"OrderDate":"1996-08-23T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":7.45,
"ShipName":"Reggiani Caseifici",
"ShipAddress":"Strada Provinciale 124",
"ShipCity":"Reggio Emilia",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10289,
"CustomerID":"BSBEV",
"OrderDate":"1996-08-26T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":22.77,
"ShipName":"B's Beverages",
"ShipAddress":"Fauntleroy Circus",
"ShipCity":"London",
"ShipRegion":null,
"ShipCountry":"UK"
},
{
"OrderID":10290,
"CustomerID":"COMMI",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":79.7,
"ShipName":"Comércio Mineiro",
"ShipAddress":"Av. dos Lusíadas, 23",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10291,
"CustomerID":"QUEDE",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-04T00:00:00.000Z",
"Freight":6.4,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10292,
"CustomerID":"TRADH",
"OrderDate":"1996-08-28T00:00:00.000Z",
"ShippedDate":"1996-09-02T00:00:00.000Z",
"Freight":1.35,
"ShipName":"Tradiçao Hipermercados",
"ShipAddress":"Av. Inês de Castro, 414",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10293,
"CustomerID":"TORTU",
"OrderDate":"1996-08-29T00:00:00.000Z",
"ShippedDate":"1996-09-11T00:00:00.000Z",
"Freight":21.18,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10294,
"CustomerID":"RATTC",
"OrderDate":"1996-08-30T00:00:00.000Z",
"ShippedDate":"1996-09-05T00:00:00.000Z",
"Freight":147.26,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
}];
});
The excel export provides an option to export multiple grid data in the same excel file.
The excel export provides support to export multiple grids in same sheet.
To export in same sheet, define multipleExport.type
as AppendToSheet in excelExportProperties
.
It have an option to provide blank rows between grids. These blank rows count can be defined by using the multipleExport.blankRows
.
<template>
<div id="app">
<p><b>First Grid:</b></p>
<ejs-grid ref='grid1' id='FirstGrid' :dataSource='fData' :toolbar='toolbarOptions' :allowExcelExport='true' :toolbarClick='toolbarClick'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='ShipCity' headerText='Ship City' width=150></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>
<p><b>Second Grid:</b></p>
<ejs-grid ref='grid2' id='SecondGrid' :dataSource='sData' :allowExcelExport='true'>
<e-columns>
<e-column field='EmployeeID' headerText='Employee ID' textAlign='Right' width=120></e-column>
<e-column field='FirstName' headerText='FirstName' width=150></e-column>
<e-column field='LastName' headerText='Last Name' width=150></e-column>
<e-column field='City' headerText='City' width=150></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, Toolbar, ExcelExport } from "@syncfusion/ej2-vue-grids";
import { data, employeeData } from './datasource.js';
Vue.use(GridPlugin);
export default {
data() {
return {
fData: data.slice(0, 5),
sData: employeeData.slice(0, 5),
toolbarOptions: ['ExcelExport']
};
},
methods: {
toolbarClick: function (args) {
if (args.item.id === 'FirstGrid_excelexport') { // 'Grid_excelexport' -> Grid component id + _ + toolbar item name
let appendExcelExportProperties = {
multipleExport: { type: 'AppendToSheet', blankRows: 2 }
};
let firstGridExport = this.$refs.grid1.excelExport(appendExcelExportProperties, true);
firstGridExport.then((fData) => {
this.$refs.grid2.excelExport(appendExcelExportProperties, false, fData);
});
}
}
},
provide: {
grid: [Toolbar, ExcelExport]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";
</style>
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.data = [
{
OrderID: 10248, CustomerID: 'VINET', EmployeeID: 5, OrderDate: new Date(8364186e5),
ShipName: 'Vins et alcools Chevalier', ShipCity: 'Reims', ShipAddress: '59 rue de l Abbaye',
ShipRegion: 'CJ', ShipPostalCode: '51100', ShipCountry: 'France', Freight: 32.38, Verified: !0
},
{
OrderID: 10249, CustomerID: 'TOMSP', EmployeeID: 6, OrderDate: new Date(836505e6),
ShipName: 'Toms Spezialitäten', ShipCity: 'Münster', ShipAddress: 'Luisenstr. 48',
ShipRegion: 'CJ', ShipPostalCode: '44087', ShipCountry: 'Germany', Freight: 11.61, Verified: !1
},
{
OrderID: 10250, CustomerID: 'HANAR', EmployeeID: 4, OrderDate: new Date(8367642e5),
ShipName: 'Hanari Carnes', ShipCity: 'Rio de Janeiro', ShipAddress: 'Rua do Paço, 67',
ShipRegion: 'RJ', ShipPostalCode: '05454-876', ShipCountry: 'Brazil', Freight: 65.83, Verified: !0
},
{
OrderID: 10251, CustomerID: 'VICTE', EmployeeID: 3, OrderDate: new Date(8367642e5),
ShipName: 'Victuailles en stock', ShipCity: 'Lyon', ShipAddress: '2, rue du Commerce',
ShipRegion: 'CJ', ShipPostalCode: '69004', ShipCountry: 'France', Freight: 41.34, Verified: !0
},
{
OrderID: 10252, CustomerID: 'SUPRD', EmployeeID: 4, OrderDate: new Date(8368506e5),
ShipName: 'Suprêmes délices', ShipCity: 'Charleroi', ShipAddress: 'Boulevard Tirou, 255',
ShipRegion: 'CJ', ShipPostalCode: 'B-6000', ShipCountry: 'Belgium', Freight: 51.3, Verified: !0
},
{
OrderID: 10253, CustomerID: 'HANAR', EmployeeID: 3, OrderDate: new Date(836937e6),
ShipName: 'Hanari Carnes', ShipCity: 'Rio de Janeiro', ShipAddress: 'Rua do Paço, 67',
ShipRegion: 'RJ', ShipPostalCode: '05454-876', ShipCountry: 'Brazil', Freight: 58.17, Verified: !0
},
{
OrderID: 10254, CustomerID: 'CHOPS', EmployeeID: 5, OrderDate: new Date(8370234e5),
ShipName: 'Chop-suey Chinese', ShipCity: 'Bern', ShipAddress: 'Hauptstr. 31',
ShipRegion: 'CJ', ShipPostalCode: '3012', ShipCountry: 'Switzerland', Freight: 22.98, Verified: !1
},
{
OrderID: 10255, CustomerID: 'RICSU', EmployeeID: 9, OrderDate: new Date(8371098e5),
ShipName: 'Richter Supermarkt', ShipCity: 'Genève', ShipAddress: 'Starenweg 5',
ShipRegion: 'CJ', ShipPostalCode: '1204', ShipCountry: 'Switzerland', Freight: 148.33, Verified: !0
},
{
OrderID: 10256, CustomerID: 'WELLI', EmployeeID: 3, OrderDate: new Date(837369e6),
ShipName: 'Wellington Importadora', ShipCity: 'Resende', ShipAddress: 'Rua do Mercado, 12',
ShipRegion: 'SP', ShipPostalCode: '08737-363', ShipCountry: 'Brazil', Freight: 13.97, Verified: !1
},
{
OrderID: 10257, CustomerID: 'HILAA', EmployeeID: 4, OrderDate: new Date(8374554e5),
ShipName: 'HILARION-Abastos', ShipCity: 'San Cristóbal', ShipAddress: 'Carrera 22 con Ave. Carlos Soublette #8-35',
ShipRegion: 'Táchira', ShipPostalCode: '5022', ShipCountry: 'Venezuela', Freight: 81.91, Verified: !0
},
{
OrderID: 10258, CustomerID: 'ERNSH', EmployeeID: 1, OrderDate: new Date(8375418e5),
ShipName: 'Ernst Handel', ShipCity: 'Graz', ShipAddress: 'Kirchgasse 6',
ShipRegion: 'CJ', ShipPostalCode: '8010', ShipCountry: 'Austria', Freight: 140.51, Verified: !0
},
{
OrderID: 10259, CustomerID: 'CENTC', EmployeeID: 4, OrderDate: new Date(8376282e5),
ShipName: 'Centro comercial Moctezuma', ShipCity: 'México D.F.', ShipAddress: 'Sierras de Granada 9993',
ShipRegion: 'CJ', ShipPostalCode: '05022', ShipCountry: 'Mexico', Freight: 3.25, Verified: !1
},
{
OrderID: 10260, CustomerID: 'OTTIK', EmployeeID: 4, OrderDate: new Date(8377146e5),
ShipName: 'Ottilies Käseladen', ShipCity: 'Köln', ShipAddress: 'Mehrheimerstr. 369',
ShipRegion: 'CJ', ShipPostalCode: '50739', ShipCountry: 'Germany', Freight: 55.09, Verified: !0
},
{
OrderID: 10261, CustomerID: 'QUEDE', EmployeeID: 4, OrderDate: new Date(8377146e5),
ShipName: 'Que Delícia', ShipCity: 'Rio de Janeiro', ShipAddress: 'Rua da Panificadora, 12',
ShipRegion: 'RJ', ShipPostalCode: '02389-673', ShipCountry: 'Brazil', Freight: 3.05, Verified: !1
},
{
OrderID: 10262, CustomerID: 'RATTC', EmployeeID: 8, OrderDate: new Date(8379738e5),
ShipName: 'Rattlesnake Canyon Grocery', ShipCity: 'Albuquerque', ShipAddress: '2817 Milton Dr.',
ShipRegion: 'NM', ShipPostalCode: '87110', ShipCountry: 'USA', Freight: 48.29, Verified: !0
}];
exports.employeeData = [{
'EmployeeID': 1,
'LastName': 'Davolio',
'FirstName': 'Nancy',
'Title': 'Sales Representative',
'TitleOfCourtesy': 'Ms.',
'BirthDate': new Date(-664743600000),
'HireDate': new Date(704692800000),
'Address': '507 - 20th Ave. E.\r\nApt. 2A',
'City': 'Seattle',
'Region': 'WA',
'PostalCode': '98122',
'Country': 'USA',
'HomePhone': '(206) 555-9857',
'Extension': '5467',
'Photo': { 'Length': 21626 },
'Notes': 'Education includes a BA in psychology from Colorado State University in 1970. She also completed\
\'The Art of the Cold Call.\' Nancy is a member of Toastmasters International.',
'ReportsTo': 2,
'PhotoPath': 'http://accweb/emmployees/davolio.bmp'
},
{
'EmployeeID': 2,
'LastName': 'Fuller',
'FirstName': 'Andrew',
'Title': 'Vice President, Sales',
'TitleOfCourtesy': 'Dr.',
'BirthDate': new Date(-563828400000),
'HireDate': new Date(713764800000),
'Address': '908 W. Capital Way',
'City': 'Tacoma',
'Region': 'WA',
'PostalCode': '98401',
'Country': 'USA',
'HomePhone': '(206) 555-9482',
'Extension': '3457',
'Photo': { 'Length': 21626 },
'Notes': 'Andrew received his BTS commercial in 1974 and a Ph.D. in international marketing from the University of \
Dallas in 1981. He is fluent in French and Italian and reads German. He joined the company as a sales representative, \
was promoted to sales manager in January 1992 and to vice president of sales in March 1993. Andrew is a member of the \
Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.',
'ReportsTo': 0,
'PhotoPath': 'http://accweb/emmployees/fuller.bmp'
},
{
'EmployeeID': 3,
'LastName': 'Leverling',
'FirstName': 'Janet',
'Title': 'Sales Representative',
'TitleOfCourtesy': 'Ms.',
'BirthDate': new Date(-200088000000),
'HireDate': new Date(702104400000),
'Address': '722 Moss Bay Blvd.',
'City': 'Kirkland',
'Region': 'WA',
'PostalCode': '98033',
'Country': 'USA',
'HomePhone': '(206) 555-3412',
'Extension': '3355',
'Photo': { 'Length': 21722 },
'Notes': 'Janet has a BS degree in chemistry from Boston College (1984). \
She has also completed a certificate program in food retailing management.\
Janet was hired as a sales associate in 1991 and promoted to sales representative in February 1992.',
'ReportsTo': 2,
'PhotoPath': 'http://accweb/emmployees/leverling.bmp'
},
{
'EmployeeID': 4,
'LastName': 'Peacock',
'FirstName': 'Margaret',
'Title': 'Sales Representative',
'TitleOfCourtesy': 'Mrs.',
'BirthDate': new Date(-1018814400000),
'HireDate': new Date(736401600000),
'Address': '4110 Old Redmond Rd.',
'City': 'Redmond',
'Region': 'WA',
'PostalCode': '98052',
'Country': 'USA',
'HomePhone': '(206) 555-8122',
'Extension': '5176',
'Photo': { 'Length': 21626 },
'Notes': 'Margaret holds a BA in English literature from Concordia College (1958) and an MA from the American \
Institute of Culinary Arts (1966). She was assigned to the London office temporarily from July through November 1992.',
'ReportsTo': 2,
'PhotoPath': 'http://accweb/emmployees/peacock.bmp'
},
{
'EmployeeID': 5,
'LastName': 'Buchanan',
'FirstName': 'Steven',
'Title': 'Sales Manager',
'TitleOfCourtesy': 'Mr.',
'BirthDate': new Date(-468010800000),
'HireDate': new Date(750830400000),
'Address': '14 Garrett Hill',
'City': 'London',
'Region': null,
'PostalCode':
'SW1 8JR',
'Country': 'UK',
'HomePhone': '(71) 555-4848',
'Extension': '3453',
'Photo': { 'Length': 21626 },
'Notes': 'Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree in 1976. Upon joining the company as \
a sales representative in 1992, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent \
post in London. He was promoted to sales manager in March 1993. Mr. Buchanan has completed the courses \'Successful \
Telemarketing\' and \'International Sales Management.\' He is fluent in French.',
'ReportsTo': 2,
'PhotoPath': 'http://accweb/emmployees/buchanan.bmp'
},
{
'EmployeeID': 6,
'LastName': 'Suyama',
'FirstName': 'Michael',
'Title': 'Sales Representative',
'TitleOfCourtesy': 'Mr.',
'BirthDate': new Date(-205185600000),
'HireDate': new Date(750830400000),
'Address': 'Coventry House\r\nMiner Rd.',
'City': 'London',
'Region': null,
'PostalCode': 'EC2 7JR',
'Country': 'UK',
'HomePhone': '(71) 555-7773',
'Extension': '428',
'Photo': { 'Length': 21626 },
'Notes': 'Michael is a graduate of Sussex University (MA, economics, 1983) and the University of California at Los Angeles \
(MBA, marketing, 1986). He has also taken the courses \'Multi-Cultural Selling\' and \'Time Management for the Sales Professional.\' \
He is fluent in Japanese and can read and write French, Portuguese, and Spanish.',
'ReportsTo': 5,
'PhotoPath': 'http://accweb/emmployees/davolio.bmp'
},
{
'EmployeeID': 7,
'LastName': 'King',
'FirstName': 'Robert',
'Title': 'Sales Representative',
'TitleOfCourtesy': 'Mr.',
'BirthDate': new Date(-302731200000),
'HireDate': new Date(757486800000),
'Address': 'Edgeham Hollow\r\nWinchester Way',
'City': 'London',
'Region': null,
'PostalCode': 'RG1 9SP',
'Country': 'UK',
'HomePhone': '(71) 555-5598',
'Extension': '465',
'Photo': { 'Length': 21626 },
'Notes': 'Robert King served in the Peace Corps and traveled extensively before completing his degree in English at the \
University of Michigan in 1992, the year he joined the company. After completing a course entitled \'Selling in Europe,\' \
he was transferred to the London office in March 1993.',
'ReportsTo': 5,
'PhotoPath': 'http://accweb/emmployees/davolio.bmp'
},
{
'EmployeeID': 8,
'LastName': 'Callahan',
'FirstName': 'Laura',
'Title': 'Inside Sales Coordinator',
'TitleOfCourtesy': 'Ms.',
'BirthDate': new Date(-377982000000),
'HireDate': new Date(762843600000),
'Address': '4726 - 11th Ave. N.E.',
'City': 'Seattle',
'Region': 'WA',
'PostalCode': '98105',
'Country': 'USA',
'HomePhone': '(206) 555-1189',
'Extension': '2344',
'Photo': { 'Length': 21626 },
'Notes': 'Laura received a BA in psychology from the University of Washington. She has also completed a course in business \
French. She reads and writes French.',
'ReportsTo': 2,
'PhotoPath': 'http://accweb/emmployees/davolio.bmp'
},
{
'EmployeeID': 9,
'LastName': 'Dodsworth',
'FirstName': 'Anne',
'Title': 'Sales Representative',
'TitleOfCourtesy': 'Ms.',
'BirthDate': new Date(-123966000000),
'HireDate': new Date(784875600000),
'Address': '7 Houndstooth Rd.',
'City': 'London',
'Region': null,
'PostalCode': 'WG2 7LT',
'Country': 'UK',
'HomePhone': '(71) 555-4444',
'Extension': '452',
'Photo': { 'Length': 21626 },
'Notes': 'Anne has a BA degree in English from St. Lawrence College. She is fluent in French and German.',
'ReportsTo': 5,
'PhotoPath': 'http://accweb/emmployees/davolio.bmp'
}];
});
By default,
multipleExport.blankRows
value is 5.
Excel exporting provides support to export multiple grids in new sheet.
To export in new sheet, define multipleExport.type
as NewSheet in excelExportProperties
.
<template>
<div id="app">
<p><b>First Grid:</b></p>
<ejs-grid ref='grid1' id='FirstGrid' :dataSource='fData' :toolbar='toolbarOptions' :allowExcelExport='true' :toolbarClick='toolbarClick'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='ShipCity' headerText='Ship City' width=150></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>
<p><b>Second Grid:</b></p>
<ejs-grid ref='grid2' id='SecondGrid' :dataSource='sData' :allowExcelExport='true'>
<e-columns>
<e-column field='EmployeeID' headerText='Employee ID' textAlign='Right' width=120></e-column>
<e-column field='FirstName' headerText='FirstName' width=150></e-column>
<e-column field='LastName' headerText='Last Name' width=150></e-column>
<e-column field='City' headerText='City' width=150></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, Toolbar, ExcelExport } from "@syncfusion/ej2-vue-grids";
import { data, employeeData } from './datasource.js';
Vue.use(GridPlugin);
export default {
data() {
return {
fData: data.slice(0, 5),
sData: employeeData.slice(0, 5),
toolbarOptions: ['ExcelExport']
};
},
methods: {
toolbarClick : function (args) {
if (args.item.id === 'FirstGrid_excelexport') { // 'Grid_excelexport' -> Grid component id + _ + toolbar item name
let appendExcelExportProperties = {
multipleExport: { type: 'NewSheet' }
};
let firstGridExport = this.$refs.grid1.excelExport(appendExcelExportProperties, true);
firstGridExport.then((fData) => {
this.$refs.grid2.excelExport(appendExcelExportProperties, false, fData);
});
}
}
},
provide: {
grid: [Toolbar, ExcelExport]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";
</style>
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.data = [
{
OrderID: 10248, CustomerID: 'VINET', EmployeeID: 5, OrderDate: new Date(8364186e5),
ShipName: 'Vins et alcools Chevalier', ShipCity: 'Reims', ShipAddress: '59 rue de l Abbaye',
ShipRegion: 'CJ', ShipPostalCode: '51100', ShipCountry: 'France', Freight: 32.38, Verified: !0
},
{
OrderID: 10249, CustomerID: 'TOMSP', EmployeeID: 6, OrderDate: new Date(836505e6),
ShipName: 'Toms Spezialitäten', ShipCity: 'Münster', ShipAddress: 'Luisenstr. 48',
ShipRegion: 'CJ', ShipPostalCode: '44087', ShipCountry: 'Germany', Freight: 11.61, Verified: !1
},
{
OrderID: 10250, CustomerID: 'HANAR', EmployeeID: 4, OrderDate: new Date(8367642e5),
ShipName: 'Hanari Carnes', ShipCity: 'Rio de Janeiro', ShipAddress: 'Rua do Paço, 67',
ShipRegion: 'RJ', ShipPostalCode: '05454-876', ShipCountry: 'Brazil', Freight: 65.83, Verified: !0
},
{
OrderID: 10251, CustomerID: 'VICTE', EmployeeID: 3, OrderDate: new Date(8367642e5),
ShipName: 'Victuailles en stock', ShipCity: 'Lyon', ShipAddress: '2, rue du Commerce',
ShipRegion: 'CJ', ShipPostalCode: '69004', ShipCountry: 'France', Freight: 41.34, Verified: !0
},
{
OrderID: 10252, CustomerID: 'SUPRD', EmployeeID: 4, OrderDate: new Date(8368506e5),
ShipName: 'Suprêmes délices', ShipCity: 'Charleroi', ShipAddress: 'Boulevard Tirou, 255',
ShipRegion: 'CJ', ShipPostalCode: 'B-6000', ShipCountry: 'Belgium', Freight: 51.3, Verified: !0
},
{
OrderID: 10253, CustomerID: 'HANAR', EmployeeID: 3, OrderDate: new Date(836937e6),
ShipName: 'Hanari Carnes', ShipCity: 'Rio de Janeiro', ShipAddress: 'Rua do Paço, 67',
ShipRegion: 'RJ', ShipPostalCode: '05454-876', ShipCountry: 'Brazil', Freight: 58.17, Verified: !0
},
{
OrderID: 10254, CustomerID: 'CHOPS', EmployeeID: 5, OrderDate: new Date(8370234e5),
ShipName: 'Chop-suey Chinese', ShipCity: 'Bern', ShipAddress: 'Hauptstr. 31',
ShipRegion: 'CJ', ShipPostalCode: '3012', ShipCountry: 'Switzerland', Freight: 22.98, Verified: !1
},
{
OrderID: 10255, CustomerID: 'RICSU', EmployeeID: 9, OrderDate: new Date(8371098e5),
ShipName: 'Richter Supermarkt', ShipCity: 'Genève', ShipAddress: 'Starenweg 5',
ShipRegion: 'CJ', ShipPostalCode: '1204', ShipCountry: 'Switzerland', Freight: 148.33, Verified: !0
},
{
OrderID: 10256, CustomerID: 'WELLI', EmployeeID: 3, OrderDate: new Date(837369e6),
ShipName: 'Wellington Importadora', ShipCity: 'Resende', ShipAddress: 'Rua do Mercado, 12',
ShipRegion: 'SP', ShipPostalCode: '08737-363', ShipCountry: 'Brazil', Freight: 13.97, Verified: !1
},
{
OrderID: 10257, CustomerID: 'HILAA', EmployeeID: 4, OrderDate: new Date(8374554e5),
ShipName: 'HILARION-Abastos', ShipCity: 'San Cristóbal', ShipAddress: 'Carrera 22 con Ave. Carlos Soublette #8-35',
ShipRegion: 'Táchira', ShipPostalCode: '5022', ShipCountry: 'Venezuela', Freight: 81.91, Verified: !0
},
{
OrderID: 10258, CustomerID: 'ERNSH', EmployeeID: 1, OrderDate: new Date(8375418e5),
ShipName: 'Ernst Handel', ShipCity: 'Graz', ShipAddress: 'Kirchgasse 6',
ShipRegion: 'CJ', ShipPostalCode: '8010', ShipCountry: 'Austria', Freight: 140.51, Verified: !0
},
{
OrderID: 10259, CustomerID: 'CENTC', EmployeeID: 4, OrderDate: new Date(8376282e5),
ShipName: 'Centro comercial Moctezuma', ShipCity: 'México D.F.', ShipAddress: 'Sierras de Granada 9993',
ShipRegion: 'CJ', ShipPostalCode: '05022', ShipCountry: 'Mexico', Freight: 3.25, Verified: !1
},
{
OrderID: 10260, CustomerID: 'OTTIK', EmployeeID: 4, OrderDate: new Date(8377146e5),
ShipName: 'Ottilies Käseladen', ShipCity: 'Köln', ShipAddress: 'Mehrheimerstr. 369',
ShipRegion: 'CJ', ShipPostalCode: '50739', ShipCountry: 'Germany', Freight: 55.09, Verified: !0
},
{
OrderID: 10261, CustomerID: 'QUEDE', EmployeeID: 4, OrderDate: new Date(8377146e5),
ShipName: 'Que Delícia', ShipCity: 'Rio de Janeiro', ShipAddress: 'Rua da Panificadora, 12',
ShipRegion: 'RJ', ShipPostalCode: '02389-673', ShipCountry: 'Brazil', Freight: 3.05, Verified: !1
},
{
OrderID: 10262, CustomerID: 'RATTC', EmployeeID: 8, OrderDate: new Date(8379738e5),
ShipName: 'Rattlesnake Canyon Grocery', ShipCity: 'Albuquerque', ShipAddress: '2817 Milton Dr.',
ShipRegion: 'NM', ShipPostalCode: '87110', ShipCountry: 'USA', Freight: 48.29, Verified: !0
}];
exports.employeeData = [{
'EmployeeID': 1,
'LastName': 'Davolio',
'FirstName': 'Nancy',
'Title': 'Sales Representative',
'TitleOfCourtesy': 'Ms.',
'BirthDate': new Date(-664743600000),
'HireDate': new Date(704692800000),
'Address': '507 - 20th Ave. E.\r\nApt. 2A',
'City': 'Seattle',
'Region': 'WA',
'PostalCode': '98122',
'Country': 'USA',
'HomePhone': '(206) 555-9857',
'Extension': '5467',
'Photo': { 'Length': 21626 },
'Notes': 'Education includes a BA in psychology from Colorado State University in 1970. She also completed\
\'The Art of the Cold Call.\' Nancy is a member of Toastmasters International.',
'ReportsTo': 2,
'PhotoPath': 'http://accweb/emmployees/davolio.bmp'
},
{
'EmployeeID': 2,
'LastName': 'Fuller',
'FirstName': 'Andrew',
'Title': 'Vice President, Sales',
'TitleOfCourtesy': 'Dr.',
'BirthDate': new Date(-563828400000),
'HireDate': new Date(713764800000),
'Address': '908 W. Capital Way',
'City': 'Tacoma',
'Region': 'WA',
'PostalCode': '98401',
'Country': 'USA',
'HomePhone': '(206) 555-9482',
'Extension': '3457',
'Photo': { 'Length': 21626 },
'Notes': 'Andrew received his BTS commercial in 1974 and a Ph.D. in international marketing from the University of \
Dallas in 1981. He is fluent in French and Italian and reads German. He joined the company as a sales representative, \
was promoted to sales manager in January 1992 and to vice president of sales in March 1993. Andrew is a member of the \
Sales Management Roundtable, the Seattle Chamber of Commerce, and the Pacific Rim Importers Association.',
'ReportsTo': 0,
'PhotoPath': 'http://accweb/emmployees/fuller.bmp'
},
{
'EmployeeID': 3,
'LastName': 'Leverling',
'FirstName': 'Janet',
'Title': 'Sales Representative',
'TitleOfCourtesy': 'Ms.',
'BirthDate': new Date(-200088000000),
'HireDate': new Date(702104400000),
'Address': '722 Moss Bay Blvd.',
'City': 'Kirkland',
'Region': 'WA',
'PostalCode': '98033',
'Country': 'USA',
'HomePhone': '(206) 555-3412',
'Extension': '3355',
'Photo': { 'Length': 21722 },
'Notes': 'Janet has a BS degree in chemistry from Boston College (1984). \
She has also completed a certificate program in food retailing management.\
Janet was hired as a sales associate in 1991 and promoted to sales representative in February 1992.',
'ReportsTo': 2,
'PhotoPath': 'http://accweb/emmployees/leverling.bmp'
},
{
'EmployeeID': 4,
'LastName': 'Peacock',
'FirstName': 'Margaret',
'Title': 'Sales Representative',
'TitleOfCourtesy': 'Mrs.',
'BirthDate': new Date(-1018814400000),
'HireDate': new Date(736401600000),
'Address': '4110 Old Redmond Rd.',
'City': 'Redmond',
'Region': 'WA',
'PostalCode': '98052',
'Country': 'USA',
'HomePhone': '(206) 555-8122',
'Extension': '5176',
'Photo': { 'Length': 21626 },
'Notes': 'Margaret holds a BA in English literature from Concordia College (1958) and an MA from the American \
Institute of Culinary Arts (1966). She was assigned to the London office temporarily from July through November 1992.',
'ReportsTo': 2,
'PhotoPath': 'http://accweb/emmployees/peacock.bmp'
},
{
'EmployeeID': 5,
'LastName': 'Buchanan',
'FirstName': 'Steven',
'Title': 'Sales Manager',
'TitleOfCourtesy': 'Mr.',
'BirthDate': new Date(-468010800000),
'HireDate': new Date(750830400000),
'Address': '14 Garrett Hill',
'City': 'London',
'Region': null,
'PostalCode':
'SW1 8JR',
'Country': 'UK',
'HomePhone': '(71) 555-4848',
'Extension': '3453',
'Photo': { 'Length': 21626 },
'Notes': 'Steven Buchanan graduated from St. Andrews University, Scotland, with a BSC degree in 1976. Upon joining the company as \
a sales representative in 1992, he spent 6 months in an orientation program at the Seattle office and then returned to his permanent \
post in London. He was promoted to sales manager in March 1993. Mr. Buchanan has completed the courses \'Successful \
Telemarketing\' and \'International Sales Management.\' He is fluent in French.',
'ReportsTo': 2,
'PhotoPath': 'http://accweb/emmployees/buchanan.bmp'
},
{
'EmployeeID': 6,
'LastName': 'Suyama',
'FirstName': 'Michael',
'Title': 'Sales Representative',
'TitleOfCourtesy': 'Mr.',
'BirthDate': new Date(-205185600000),
'HireDate': new Date(750830400000),
'Address': 'Coventry House\r\nMiner Rd.',
'City': 'London',
'Region': null,
'PostalCode': 'EC2 7JR',
'Country': 'UK',
'HomePhone': '(71) 555-7773',
'Extension': '428',
'Photo': { 'Length': 21626 },
'Notes': 'Michael is a graduate of Sussex University (MA, economics, 1983) and the University of California at Los Angeles \
(MBA, marketing, 1986). He has also taken the courses \'Multi-Cultural Selling\' and \'Time Management for the Sales Professional.\' \
He is fluent in Japanese and can read and write French, Portuguese, and Spanish.',
'ReportsTo': 5,
'PhotoPath': 'http://accweb/emmployees/davolio.bmp'
},
{
'EmployeeID': 7,
'LastName': 'King',
'FirstName': 'Robert',
'Title': 'Sales Representative',
'TitleOfCourtesy': 'Mr.',
'BirthDate': new Date(-302731200000),
'HireDate': new Date(757486800000),
'Address': 'Edgeham Hollow\r\nWinchester Way',
'City': 'London',
'Region': null,
'PostalCode': 'RG1 9SP',
'Country': 'UK',
'HomePhone': '(71) 555-5598',
'Extension': '465',
'Photo': { 'Length': 21626 },
'Notes': 'Robert King served in the Peace Corps and traveled extensively before completing his degree in English at the \
University of Michigan in 1992, the year he joined the company. After completing a course entitled \'Selling in Europe,\' \
he was transferred to the London office in March 1993.',
'ReportsTo': 5,
'PhotoPath': 'http://accweb/emmployees/davolio.bmp'
},
{
'EmployeeID': 8,
'LastName': 'Callahan',
'FirstName': 'Laura',
'Title': 'Inside Sales Coordinator',
'TitleOfCourtesy': 'Ms.',
'BirthDate': new Date(-377982000000),
'HireDate': new Date(762843600000),
'Address': '4726 - 11th Ave. N.E.',
'City': 'Seattle',
'Region': 'WA',
'PostalCode': '98105',
'Country': 'USA',
'HomePhone': '(206) 555-1189',
'Extension': '2344',
'Photo': { 'Length': 21626 },
'Notes': 'Laura received a BA in psychology from the University of Washington. She has also completed a course in business \
French. She reads and writes French.',
'ReportsTo': 2,
'PhotoPath': 'http://accweb/emmployees/davolio.bmp'
},
{
'EmployeeID': 9,
'LastName': 'Dodsworth',
'FirstName': 'Anne',
'Title': 'Sales Representative',
'TitleOfCourtesy': 'Ms.',
'BirthDate': new Date(-123966000000),
'HireDate': new Date(784875600000),
'Address': '7 Houndstooth Rd.',
'City': 'London',
'Region': null,
'PostalCode': 'WG2 7LT',
'Country': 'UK',
'HomePhone': '(71) 555-4444',
'Extension': '452',
'Photo': { 'Length': 21626 },
'Notes': 'Anne has a BA degree in English from St. Lawrence College. She is fluent in French and German.',
'ReportsTo': 5,
'PhotoPath': 'http://accweb/emmployees/davolio.bmp'
}];
});
The excel export provides an option to customize mapping of the grid to excel document.
To get start quickly with Excel export Options, you can check on this video:
The excel export provides an option to export the current page into excel. To export current page, define exportType
to CurrentPage.
<template>
<div id="app">
<ejs-grid ref='grid' id='Grid' :dataSource='data' :toolbar='toolbarOptions' height='220px' :allowPaging='true' :allowExcelExport='true' :toolbarClick='toolbarClick'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='ShipCity' headerText='Ship City' width=150></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, Toolbar, ExcelExport, Page } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
Vue.use(GridPlugin);
export default {
data() {
return {
data: data,
toolbarOptions: ['ExcelExport']
};
},
methods: {
toolbarClick: function(args) {
if (args.item.id === 'Grid_excelexport') { // 'Grid_excelexport' -> Grid component id + _ + toolbar item name
let excelExportProperties = {
exportType: 'CurrentPage'
};
this.$refs.grid.excelExport(excelExportProperties);
}
}
},
provide: {
grid: [Toolbar, ExcelExport, Page]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";
</style>
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.data = [
{
"OrderID":10248,
"CustomerID":"VINET",
"OrderDate":"1996-07-04T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":32.38,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10249,
"CustomerID":"TOMSP",
"OrderDate":"1996-07-05T00:00:00.000Z",
"ShippedDate":"1996-07-10T00:00:00.000Z",
"Freight":11.61,
"ShipName":"Toms Spezialitäten",
"ShipAddress":"Luisenstr. 48",
"ShipCity":"Münster",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10250,
"CustomerID":"HANAR",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-12T00:00:00.000Z",
"Freight":65.83,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10251,
"CustomerID":"VICTE",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":41.34,
"ShipName":"Victuailles en stock",
"ShipAddress":"2, rue du Commerce",
"ShipCity":"Lyon",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10252,
"CustomerID":"SUPRD",
"OrderDate":"1996-07-09T00:00:00.000Z",
"ShippedDate":"1996-07-11T00:00:00.000Z",
"Freight":51.3,
"ShipName":"Suprêmes délices",
"ShipAddress":"Boulevard Tirou, 255",
"ShipCity":"Charleroi",
"ShipRegion":null,
"ShipCountry":"Belgium"
},
{
"OrderID":10253,
"CustomerID":"HANAR",
"OrderDate":"1996-07-10T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":58.17,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10254,
"CustomerID":"CHOPS",
"OrderDate":"1996-07-11T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":22.98,
"ShipName":"Chop-suey Chinese",
"ShipAddress":"Hauptstr. 31",
"ShipCity":"Bern",
"ShipRegion":null,
"ShipCountry":"Switzerland",
"Verified": true
},
{
"OrderID":10255,
"CustomerID":"RICSU",
"OrderDate":"1996-07-12T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":148.33,
"ShipName":"Richter Supermarkt",
"ShipAddress":"Starenweg 5",
"ShipCity":"Genève",
"ShipRegion":null,
"ShipCountry":"Switzerland"
},
{
"OrderID":10256,
"CustomerID":"WELLI",
"OrderDate":"1996-07-15T00:00:00.000Z",
"ShippedDate":"1996-07-17T00:00:00.000Z",
"Freight":13.97,
"ShipName":"Wellington Importadora",
"ShipAddress":"Rua do Mercado, 12",
"ShipCity":"Resende",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10257,
"CustomerID":"HILAA",
"OrderDate":"1996-07-16T00:00:00.000Z",
"ShippedDate":"1996-07-22T00:00:00.000Z",
"Freight":81.91,
"ShipName":"HILARION-Abastos",
"ShipAddress":"Carrera 22 con Ave. Carlos Soublette #8-35",
"ShipCity":"San Cristóbal",
"ShipRegion":"Táchira",
"ShipCountry":"Venezuela"
},
{
"OrderID":10258,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-17T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":140.51,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"ShipCountry":"Austria"
},
{
"OrderID":10259,
"CustomerID":"CENTC",
"OrderDate":"1996-07-18T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":3.25,
"ShipName":"Centro comercial Moctezuma",
"ShipAddress":"Sierras de Granada 9993",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico",
"Verified": true
},
{
"OrderID":10260,
"CustomerID":"OTTIK",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-29T00:00:00.000Z",
"Freight":55.09,
"ShipName":"Ottilies Käseladen",
"ShipAddress":"Mehrheimerstr. 369",
"ShipCity":"Köln",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10261,
"CustomerID":"QUEDE",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-30T00:00:00.000Z",
"Freight":3.05,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10262,
"CustomerID":"RATTC",
"OrderDate":"1996-07-22T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":48.29,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA",
"Verified": true
},
{
"OrderID":10263,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-23T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":146.06,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"Verified": true,
"ShipCountry":"Austria"
},
{
"OrderID":10264,
"CustomerID":"FOLKO",
"OrderDate":"1996-07-24T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":3.67,
"ShipName":"Folk och fä HB",
"ShipAddress":"Åkergatan 24",
"ShipCity":"Bräcke",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10265,
"CustomerID":"BLONP",
"OrderDate":"1996-07-25T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":55.28,
"ShipName":"Blondel père et fils",
"ShipAddress":"24, place Kléber",
"ShipCity":"Strasbourg",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10266,
"CustomerID":"WARTH",
"OrderDate":"1996-07-26T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":25.73,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10267,
"CustomerID":"FRANK",
"OrderDate":"1996-07-29T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":208.58,
"ShipName":"Frankenversand",
"ShipAddress":"Berliner Platz 43",
"ShipCity":"München",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10268,
"CustomerID":"GROSR",
"OrderDate":"1996-07-30T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":66.29,
"ShipName":"GROSELLA-Restaurante",
"ShipAddress":"5ª Ave. Los Palos Grandes",
"ShipCity":"Caracas",
"ShipRegion":"DF",
"ShipCountry":"Venezuela"
},
{
"OrderID":10269,
"CustomerID":"WHITC",
"OrderDate":"1996-07-31T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":4.56,
"ShipName":"White Clover Markets",
"ShipAddress":"1029 - 12th Ave. S.",
"ShipCity":"Seattle",
"ShipRegion":"WA",
"ShipCountry":"USA"
},
{
"OrderID":10270,
"CustomerID":"WARTH",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":136.54,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10271,
"CustomerID":"SPLIR",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":4.54,
"ShipName":"Split Rail Beer & Ale",
"ShipAddress":"P.O. Box 555",
"ShipCity":"Lander",
"ShipRegion":"WY",
"ShipCountry":"USA"
},
{
"OrderID":10272,
"CustomerID":"RATTC",
"OrderDate":"1996-08-02T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":98.03,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
},
{
"OrderID":10273,
"CustomerID":"QUICK",
"OrderDate":"1996-08-05T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":76.07,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10274,
"CustomerID":"VINET",
"OrderDate":"1996-08-06T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":6.01,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10275,
"CustomerID":"MAGAA",
"OrderDate":"1996-08-07T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":26.93,
"ShipName":"Magazzini Alimentari Riuniti",
"ShipAddress":"Via Ludovico il Moro 22",
"ShipCity":"Bergamo",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10276,
"CustomerID":"TORTU",
"OrderDate":"1996-08-08T00:00:00.000Z",
"ShippedDate":"1996-08-14T00:00:00.000Z",
"Freight":13.84,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10277,
"CustomerID":"MORGK",
"OrderDate":"1996-08-09T00:00:00.000Z",
"ShippedDate":"1996-08-13T00:00:00.000Z",
"Freight":125.77,
"ShipName":"Morgenstern Gesundkost",
"ShipAddress":"Heerstr. 22",
"ShipCity":"Leipzig",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10278,
"CustomerID":"BERGS",
"OrderDate":"1996-08-12T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":92.69,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10279,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-13T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":25.83,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10280,
"CustomerID":"BERGS",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-09-12T00:00:00.000Z",
"Freight":8.98,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden",
"Verified": true
},
{
"OrderID":10281,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":2.94,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10282,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-15T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":12.69,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10283,
"CustomerID":"LILAS",
"OrderDate":"1996-08-16T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":84.81,
"ShipName":"LILA-Supermercado",
"ShipAddress":"Carrera 52 con Ave. Bolívar #65-98 Llano Largo",
"ShipCity":"Barquisimeto",
"ShipRegion":"Lara",
"ShipCountry":"Venezuela"
},
{
"OrderID":10284,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-19T00:00:00.000Z",
"ShippedDate":"1996-08-27T00:00:00.000Z",
"Freight":76.56,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10285,
"CustomerID":"QUICK",
"OrderDate":"1996-08-20T00:00:00.000Z",
"ShippedDate":"1996-08-26T00:00:00.000Z",
"Freight":76.83,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10286,
"CustomerID":"QUICK",
"OrderDate":"1996-08-21T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":229.24,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10287,
"CustomerID":"RICAR",
"OrderDate":"1996-08-22T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":12.76,
"ShipName":"Ricardo Adocicados",
"ShipAddress":"Av. Copacabana, 267",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10288,
"CustomerID":"REGGC",
"OrderDate":"1996-08-23T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":7.45,
"ShipName":"Reggiani Caseifici",
"ShipAddress":"Strada Provinciale 124",
"ShipCity":"Reggio Emilia",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10289,
"CustomerID":"BSBEV",
"OrderDate":"1996-08-26T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":22.77,
"ShipName":"B's Beverages",
"ShipAddress":"Fauntleroy Circus",
"ShipCity":"London",
"ShipRegion":null,
"ShipCountry":"UK"
},
{
"OrderID":10290,
"CustomerID":"COMMI",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":79.7,
"ShipName":"Comércio Mineiro",
"ShipAddress":"Av. dos Lusíadas, 23",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10291,
"CustomerID":"QUEDE",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-04T00:00:00.000Z",
"Freight":6.4,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10292,
"CustomerID":"TRADH",
"OrderDate":"1996-08-28T00:00:00.000Z",
"ShippedDate":"1996-09-02T00:00:00.000Z",
"Freight":1.35,
"ShipName":"Tradiçao Hipermercados",
"ShipAddress":"Av. Inês de Castro, 414",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10293,
"CustomerID":"TORTU",
"OrderDate":"1996-08-29T00:00:00.000Z",
"ShippedDate":"1996-09-11T00:00:00.000Z",
"Freight":21.18,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10294,
"CustomerID":"RATTC",
"OrderDate":"1996-08-30T00:00:00.000Z",
"ShippedDate":"1996-09-05T00:00:00.000Z",
"Freight":147.26,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
}];
});
The excel export provides an option to export hidden columns of grid by defining includeHiddenColumn
as true.
<template>
<div id="app">
<ejs-grid ref='grid' id='Grid' :dataSource='data' :toolbar='toolbarOptions' height='270px' :allowPaging='true' :allowExcelExport='true' :toolbarClick='toolbarClick'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='ShipCity' headerText='Ship City' width=150 :visible='false'></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, Toolbar, ExcelExport } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
Vue.use(GridPlugin);
export default {
data() {
return {
data: data,
toolbarOptions: ['ExcelExport']
};
},
methods: {
toolbarClick: function(args) {
if (args.item.id === 'Grid_excelexport') { // 'Grid_excelexport' -> Grid component id + _ + toolbar item name
let excelExportProperties = {
includeHiddenColumn: true
};
this.$refs.grid.excelExport(excelExportProperties);
}
}
},
provide: {
grid: [Toolbar, ExcelExport]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";
</style>
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.data = [
{
"OrderID":10248,
"CustomerID":"VINET",
"OrderDate":"1996-07-04T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":32.38,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10249,
"CustomerID":"TOMSP",
"OrderDate":"1996-07-05T00:00:00.000Z",
"ShippedDate":"1996-07-10T00:00:00.000Z",
"Freight":11.61,
"ShipName":"Toms Spezialitäten",
"ShipAddress":"Luisenstr. 48",
"ShipCity":"Münster",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10250,
"CustomerID":"HANAR",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-12T00:00:00.000Z",
"Freight":65.83,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10251,
"CustomerID":"VICTE",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":41.34,
"ShipName":"Victuailles en stock",
"ShipAddress":"2, rue du Commerce",
"ShipCity":"Lyon",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10252,
"CustomerID":"SUPRD",
"OrderDate":"1996-07-09T00:00:00.000Z",
"ShippedDate":"1996-07-11T00:00:00.000Z",
"Freight":51.3,
"ShipName":"Suprêmes délices",
"ShipAddress":"Boulevard Tirou, 255",
"ShipCity":"Charleroi",
"ShipRegion":null,
"ShipCountry":"Belgium"
},
{
"OrderID":10253,
"CustomerID":"HANAR",
"OrderDate":"1996-07-10T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":58.17,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10254,
"CustomerID":"CHOPS",
"OrderDate":"1996-07-11T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":22.98,
"ShipName":"Chop-suey Chinese",
"ShipAddress":"Hauptstr. 31",
"ShipCity":"Bern",
"ShipRegion":null,
"ShipCountry":"Switzerland",
"Verified": true
},
{
"OrderID":10255,
"CustomerID":"RICSU",
"OrderDate":"1996-07-12T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":148.33,
"ShipName":"Richter Supermarkt",
"ShipAddress":"Starenweg 5",
"ShipCity":"Genève",
"ShipRegion":null,
"ShipCountry":"Switzerland"
},
{
"OrderID":10256,
"CustomerID":"WELLI",
"OrderDate":"1996-07-15T00:00:00.000Z",
"ShippedDate":"1996-07-17T00:00:00.000Z",
"Freight":13.97,
"ShipName":"Wellington Importadora",
"ShipAddress":"Rua do Mercado, 12",
"ShipCity":"Resende",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10257,
"CustomerID":"HILAA",
"OrderDate":"1996-07-16T00:00:00.000Z",
"ShippedDate":"1996-07-22T00:00:00.000Z",
"Freight":81.91,
"ShipName":"HILARION-Abastos",
"ShipAddress":"Carrera 22 con Ave. Carlos Soublette #8-35",
"ShipCity":"San Cristóbal",
"ShipRegion":"Táchira",
"ShipCountry":"Venezuela"
},
{
"OrderID":10258,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-17T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":140.51,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"ShipCountry":"Austria"
},
{
"OrderID":10259,
"CustomerID":"CENTC",
"OrderDate":"1996-07-18T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":3.25,
"ShipName":"Centro comercial Moctezuma",
"ShipAddress":"Sierras de Granada 9993",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico",
"Verified": true
},
{
"OrderID":10260,
"CustomerID":"OTTIK",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-29T00:00:00.000Z",
"Freight":55.09,
"ShipName":"Ottilies Käseladen",
"ShipAddress":"Mehrheimerstr. 369",
"ShipCity":"Köln",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10261,
"CustomerID":"QUEDE",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-30T00:00:00.000Z",
"Freight":3.05,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10262,
"CustomerID":"RATTC",
"OrderDate":"1996-07-22T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":48.29,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA",
"Verified": true
},
{
"OrderID":10263,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-23T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":146.06,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"Verified": true,
"ShipCountry":"Austria"
},
{
"OrderID":10264,
"CustomerID":"FOLKO",
"OrderDate":"1996-07-24T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":3.67,
"ShipName":"Folk och fä HB",
"ShipAddress":"Åkergatan 24",
"ShipCity":"Bräcke",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10265,
"CustomerID":"BLONP",
"OrderDate":"1996-07-25T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":55.28,
"ShipName":"Blondel père et fils",
"ShipAddress":"24, place Kléber",
"ShipCity":"Strasbourg",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10266,
"CustomerID":"WARTH",
"OrderDate":"1996-07-26T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":25.73,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10267,
"CustomerID":"FRANK",
"OrderDate":"1996-07-29T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":208.58,
"ShipName":"Frankenversand",
"ShipAddress":"Berliner Platz 43",
"ShipCity":"München",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10268,
"CustomerID":"GROSR",
"OrderDate":"1996-07-30T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":66.29,
"ShipName":"GROSELLA-Restaurante",
"ShipAddress":"5ª Ave. Los Palos Grandes",
"ShipCity":"Caracas",
"ShipRegion":"DF",
"ShipCountry":"Venezuela"
},
{
"OrderID":10269,
"CustomerID":"WHITC",
"OrderDate":"1996-07-31T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":4.56,
"ShipName":"White Clover Markets",
"ShipAddress":"1029 - 12th Ave. S.",
"ShipCity":"Seattle",
"ShipRegion":"WA",
"ShipCountry":"USA"
},
{
"OrderID":10270,
"CustomerID":"WARTH",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":136.54,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10271,
"CustomerID":"SPLIR",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":4.54,
"ShipName":"Split Rail Beer & Ale",
"ShipAddress":"P.O. Box 555",
"ShipCity":"Lander",
"ShipRegion":"WY",
"ShipCountry":"USA"
},
{
"OrderID":10272,
"CustomerID":"RATTC",
"OrderDate":"1996-08-02T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":98.03,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
},
{
"OrderID":10273,
"CustomerID":"QUICK",
"OrderDate":"1996-08-05T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":76.07,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10274,
"CustomerID":"VINET",
"OrderDate":"1996-08-06T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":6.01,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10275,
"CustomerID":"MAGAA",
"OrderDate":"1996-08-07T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":26.93,
"ShipName":"Magazzini Alimentari Riuniti",
"ShipAddress":"Via Ludovico il Moro 22",
"ShipCity":"Bergamo",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10276,
"CustomerID":"TORTU",
"OrderDate":"1996-08-08T00:00:00.000Z",
"ShippedDate":"1996-08-14T00:00:00.000Z",
"Freight":13.84,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10277,
"CustomerID":"MORGK",
"OrderDate":"1996-08-09T00:00:00.000Z",
"ShippedDate":"1996-08-13T00:00:00.000Z",
"Freight":125.77,
"ShipName":"Morgenstern Gesundkost",
"ShipAddress":"Heerstr. 22",
"ShipCity":"Leipzig",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10278,
"CustomerID":"BERGS",
"OrderDate":"1996-08-12T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":92.69,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10279,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-13T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":25.83,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10280,
"CustomerID":"BERGS",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-09-12T00:00:00.000Z",
"Freight":8.98,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden",
"Verified": true
},
{
"OrderID":10281,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":2.94,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10282,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-15T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":12.69,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10283,
"CustomerID":"LILAS",
"OrderDate":"1996-08-16T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":84.81,
"ShipName":"LILA-Supermercado",
"ShipAddress":"Carrera 52 con Ave. Bolívar #65-98 Llano Largo",
"ShipCity":"Barquisimeto",
"ShipRegion":"Lara",
"ShipCountry":"Venezuela"
},
{
"OrderID":10284,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-19T00:00:00.000Z",
"ShippedDate":"1996-08-27T00:00:00.000Z",
"Freight":76.56,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10285,
"CustomerID":"QUICK",
"OrderDate":"1996-08-20T00:00:00.000Z",
"ShippedDate":"1996-08-26T00:00:00.000Z",
"Freight":76.83,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10286,
"CustomerID":"QUICK",
"OrderDate":"1996-08-21T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":229.24,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10287,
"CustomerID":"RICAR",
"OrderDate":"1996-08-22T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":12.76,
"ShipName":"Ricardo Adocicados",
"ShipAddress":"Av. Copacabana, 267",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10288,
"CustomerID":"REGGC",
"OrderDate":"1996-08-23T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":7.45,
"ShipName":"Reggiani Caseifici",
"ShipAddress":"Strada Provinciale 124",
"ShipCity":"Reggio Emilia",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10289,
"CustomerID":"BSBEV",
"OrderDate":"1996-08-26T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":22.77,
"ShipName":"B's Beverages",
"ShipAddress":"Fauntleroy Circus",
"ShipCity":"London",
"ShipRegion":null,
"ShipCountry":"UK"
},
{
"OrderID":10290,
"CustomerID":"COMMI",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":79.7,
"ShipName":"Comércio Mineiro",
"ShipAddress":"Av. dos Lusíadas, 23",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10291,
"CustomerID":"QUEDE",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-04T00:00:00.000Z",
"Freight":6.4,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10292,
"CustomerID":"TRADH",
"OrderDate":"1996-08-28T00:00:00.000Z",
"ShippedDate":"1996-09-02T00:00:00.000Z",
"Freight":1.35,
"ShipName":"Tradiçao Hipermercados",
"ShipAddress":"Av. Inês de Castro, 414",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10293,
"CustomerID":"TORTU",
"OrderDate":"1996-08-29T00:00:00.000Z",
"ShippedDate":"1996-09-11T00:00:00.000Z",
"Freight":21.18,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10294,
"CustomerID":"RATTC",
"OrderDate":"1996-08-30T00:00:00.000Z",
"ShippedDate":"1996-09-05T00:00:00.000Z",
"Freight":147.26,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
}];
});
You can show a hidden column or hide a visible column while printing the grid using toolbarClick
and pdfExportComplete
events.
In the toolbarClick
event, based on args.item.id as Grid_pdfexport. We can show or hide columns by setting column.visible
property to true or false respectively.
In the pdfExportComplete event, We have reversed the state back to the previous state.
In the below example, we have CustomerID as a hidden column in the grid. While exporting, we have changed CustomerID to visible column and ShipCity as hidden column.
<template>
<div id="app">
<ejs-grid ref='grid' id='Grid' :dataSource='data' :toolbar='toolbarOptions' height='272px' :allowExcelExport='true' :excelExportComplete='excelExportComplete' :toolbarClick='toolbarClick'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' :visible='false' width=150></e-column>
<e-column field='ShipCity' headerText='Ship City' width=150></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, Toolbar, ExcelExport } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
Vue.use(GridPlugin);
export default {
data() {
return {
data: data,
toolbarOptions: ['ExcelExport']
};
},
methods: {
toolbarClick: function(args) {
if (args.item.id === 'Grid_excelexport') {
this.$refs.grid.getColumns()[1].visible = true;
this.$refs.grid.getColumns()[3].visible = false;
this.$refs.grid.excelExport();
}
},
excelExportComplete(args) {
this.$refs.grid.getColumns()[1].visible = true;
this.$refs.grid.getColumns()[3].visible = true;
}
},
provide: {
grid: [Toolbar, ExcelExport]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";
</style>
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.data = [
{
"OrderID":10248,
"CustomerID":"VINET",
"OrderDate":"1996-07-04T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":32.38,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10249,
"CustomerID":"TOMSP",
"OrderDate":"1996-07-05T00:00:00.000Z",
"ShippedDate":"1996-07-10T00:00:00.000Z",
"Freight":11.61,
"ShipName":"Toms Spezialitäten",
"ShipAddress":"Luisenstr. 48",
"ShipCity":"Münster",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10250,
"CustomerID":"HANAR",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-12T00:00:00.000Z",
"Freight":65.83,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10251,
"CustomerID":"VICTE",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":41.34,
"ShipName":"Victuailles en stock",
"ShipAddress":"2, rue du Commerce",
"ShipCity":"Lyon",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10252,
"CustomerID":"SUPRD",
"OrderDate":"1996-07-09T00:00:00.000Z",
"ShippedDate":"1996-07-11T00:00:00.000Z",
"Freight":51.3,
"ShipName":"Suprêmes délices",
"ShipAddress":"Boulevard Tirou, 255",
"ShipCity":"Charleroi",
"ShipRegion":null,
"ShipCountry":"Belgium"
},
{
"OrderID":10253,
"CustomerID":"HANAR",
"OrderDate":"1996-07-10T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":58.17,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10254,
"CustomerID":"CHOPS",
"OrderDate":"1996-07-11T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":22.98,
"ShipName":"Chop-suey Chinese",
"ShipAddress":"Hauptstr. 31",
"ShipCity":"Bern",
"ShipRegion":null,
"ShipCountry":"Switzerland",
"Verified": true
},
{
"OrderID":10255,
"CustomerID":"RICSU",
"OrderDate":"1996-07-12T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":148.33,
"ShipName":"Richter Supermarkt",
"ShipAddress":"Starenweg 5",
"ShipCity":"Genève",
"ShipRegion":null,
"ShipCountry":"Switzerland"
},
{
"OrderID":10256,
"CustomerID":"WELLI",
"OrderDate":"1996-07-15T00:00:00.000Z",
"ShippedDate":"1996-07-17T00:00:00.000Z",
"Freight":13.97,
"ShipName":"Wellington Importadora",
"ShipAddress":"Rua do Mercado, 12",
"ShipCity":"Resende",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10257,
"CustomerID":"HILAA",
"OrderDate":"1996-07-16T00:00:00.000Z",
"ShippedDate":"1996-07-22T00:00:00.000Z",
"Freight":81.91,
"ShipName":"HILARION-Abastos",
"ShipAddress":"Carrera 22 con Ave. Carlos Soublette #8-35",
"ShipCity":"San Cristóbal",
"ShipRegion":"Táchira",
"ShipCountry":"Venezuela"
},
{
"OrderID":10258,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-17T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":140.51,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"ShipCountry":"Austria"
},
{
"OrderID":10259,
"CustomerID":"CENTC",
"OrderDate":"1996-07-18T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":3.25,
"ShipName":"Centro comercial Moctezuma",
"ShipAddress":"Sierras de Granada 9993",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico",
"Verified": true
},
{
"OrderID":10260,
"CustomerID":"OTTIK",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-29T00:00:00.000Z",
"Freight":55.09,
"ShipName":"Ottilies Käseladen",
"ShipAddress":"Mehrheimerstr. 369",
"ShipCity":"Köln",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10261,
"CustomerID":"QUEDE",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-30T00:00:00.000Z",
"Freight":3.05,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10262,
"CustomerID":"RATTC",
"OrderDate":"1996-07-22T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":48.29,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA",
"Verified": true
},
{
"OrderID":10263,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-23T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":146.06,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"Verified": true,
"ShipCountry":"Austria"
},
{
"OrderID":10264,
"CustomerID":"FOLKO",
"OrderDate":"1996-07-24T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":3.67,
"ShipName":"Folk och fä HB",
"ShipAddress":"Åkergatan 24",
"ShipCity":"Bräcke",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10265,
"CustomerID":"BLONP",
"OrderDate":"1996-07-25T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":55.28,
"ShipName":"Blondel père et fils",
"ShipAddress":"24, place Kléber",
"ShipCity":"Strasbourg",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10266,
"CustomerID":"WARTH",
"OrderDate":"1996-07-26T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":25.73,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10267,
"CustomerID":"FRANK",
"OrderDate":"1996-07-29T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":208.58,
"ShipName":"Frankenversand",
"ShipAddress":"Berliner Platz 43",
"ShipCity":"München",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10268,
"CustomerID":"GROSR",
"OrderDate":"1996-07-30T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":66.29,
"ShipName":"GROSELLA-Restaurante",
"ShipAddress":"5ª Ave. Los Palos Grandes",
"ShipCity":"Caracas",
"ShipRegion":"DF",
"ShipCountry":"Venezuela"
},
{
"OrderID":10269,
"CustomerID":"WHITC",
"OrderDate":"1996-07-31T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":4.56,
"ShipName":"White Clover Markets",
"ShipAddress":"1029 - 12th Ave. S.",
"ShipCity":"Seattle",
"ShipRegion":"WA",
"ShipCountry":"USA"
},
{
"OrderID":10270,
"CustomerID":"WARTH",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":136.54,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10271,
"CustomerID":"SPLIR",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":4.54,
"ShipName":"Split Rail Beer & Ale",
"ShipAddress":"P.O. Box 555",
"ShipCity":"Lander",
"ShipRegion":"WY",
"ShipCountry":"USA"
},
{
"OrderID":10272,
"CustomerID":"RATTC",
"OrderDate":"1996-08-02T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":98.03,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
},
{
"OrderID":10273,
"CustomerID":"QUICK",
"OrderDate":"1996-08-05T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":76.07,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10274,
"CustomerID":"VINET",
"OrderDate":"1996-08-06T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":6.01,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10275,
"CustomerID":"MAGAA",
"OrderDate":"1996-08-07T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":26.93,
"ShipName":"Magazzini Alimentari Riuniti",
"ShipAddress":"Via Ludovico il Moro 22",
"ShipCity":"Bergamo",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10276,
"CustomerID":"TORTU",
"OrderDate":"1996-08-08T00:00:00.000Z",
"ShippedDate":"1996-08-14T00:00:00.000Z",
"Freight":13.84,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10277,
"CustomerID":"MORGK",
"OrderDate":"1996-08-09T00:00:00.000Z",
"ShippedDate":"1996-08-13T00:00:00.000Z",
"Freight":125.77,
"ShipName":"Morgenstern Gesundkost",
"ShipAddress":"Heerstr. 22",
"ShipCity":"Leipzig",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10278,
"CustomerID":"BERGS",
"OrderDate":"1996-08-12T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":92.69,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10279,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-13T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":25.83,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10280,
"CustomerID":"BERGS",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-09-12T00:00:00.000Z",
"Freight":8.98,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden",
"Verified": true
},
{
"OrderID":10281,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":2.94,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10282,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-15T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":12.69,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10283,
"CustomerID":"LILAS",
"OrderDate":"1996-08-16T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":84.81,
"ShipName":"LILA-Supermercado",
"ShipAddress":"Carrera 52 con Ave. Bolívar #65-98 Llano Largo",
"ShipCity":"Barquisimeto",
"ShipRegion":"Lara",
"ShipCountry":"Venezuela"
},
{
"OrderID":10284,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-19T00:00:00.000Z",
"ShippedDate":"1996-08-27T00:00:00.000Z",
"Freight":76.56,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10285,
"CustomerID":"QUICK",
"OrderDate":"1996-08-20T00:00:00.000Z",
"ShippedDate":"1996-08-26T00:00:00.000Z",
"Freight":76.83,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10286,
"CustomerID":"QUICK",
"OrderDate":"1996-08-21T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":229.24,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10287,
"CustomerID":"RICAR",
"OrderDate":"1996-08-22T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":12.76,
"ShipName":"Ricardo Adocicados",
"ShipAddress":"Av. Copacabana, 267",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10288,
"CustomerID":"REGGC",
"OrderDate":"1996-08-23T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":7.45,
"ShipName":"Reggiani Caseifici",
"ShipAddress":"Strada Provinciale 124",
"ShipCity":"Reggio Emilia",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10289,
"CustomerID":"BSBEV",
"OrderDate":"1996-08-26T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":22.77,
"ShipName":"B's Beverages",
"ShipAddress":"Fauntleroy Circus",
"ShipCity":"London",
"ShipRegion":null,
"ShipCountry":"UK"
},
{
"OrderID":10290,
"CustomerID":"COMMI",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":79.7,
"ShipName":"Comércio Mineiro",
"ShipAddress":"Av. dos Lusíadas, 23",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10291,
"CustomerID":"QUEDE",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-04T00:00:00.000Z",
"Freight":6.4,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10292,
"CustomerID":"TRADH",
"OrderDate":"1996-08-28T00:00:00.000Z",
"ShippedDate":"1996-09-02T00:00:00.000Z",
"Freight":1.35,
"ShipName":"Tradiçao Hipermercados",
"ShipAddress":"Av. Inês de Castro, 414",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10293,
"CustomerID":"TORTU",
"OrderDate":"1996-08-29T00:00:00.000Z",
"ShippedDate":"1996-09-11T00:00:00.000Z",
"Freight":21.18,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10294,
"CustomerID":"RATTC",
"OrderDate":"1996-08-30T00:00:00.000Z",
"ShippedDate":"1996-09-05T00:00:00.000Z",
"Freight":147.26,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
}];
});
Grid cells in the exported Excel can be customized or formatted using excelQueryCellInfo
event. In this event, we can format the grid cells of exported PDF document based on the column cell value.
In the below sample, we have set the background color for Freight column in the exported excel by args.cell and backColor property.
<template>
<div id="app">
<ejs-grid ref='grid' id='Grid' :dataSource='data' :toolbar='toolbarOptions' height='272px' :allowExcelExport='true' :queryCellInfo='queryCellInfo' :excelQueryCellInfo='excelQueryCellInfo' :toolbarClick='toolbarClick'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='Freight' headerText='Freight' width=150></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, Toolbar, ExcelExport } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
Vue.use(GridPlugin);
export default {
data() {
return {
data: data,
toolbarOptions: ['ExcelExport']
};
},
methods: {
toolbarClick: function(args) {
if (args.item.id === 'Grid_excelexport') {
this.$refs.grid.excelExport();
}
},
excelQueryCellInfo(args) {
if(args.column.field == 'Freight')
if(args.value < 30) {
args.style = {backColor: '#99ffcc'};
}
else if(args.value < 60) {
args.style = {backColor: '#ffffb3'};
}
else {
args.style = {backColor: '#ff704d'};
}
},
queryCellInfo(args) {
if(args.column.field == 'Freight'){
if(args.data['Freight'] < 30) {
args.cell.bgColor = '#99ffcc';
}
else if(args.data['Freight'] < 60) {
args.cell.bgColor = '#ffffb3';
}
else {
args.cell.bgColor = '#ff704d';
}
}
}
},
provide: {
grid: [Toolbar, ExcelExport]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";
</style>
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.data = [
{
"OrderID":10248,
"CustomerID":"VINET",
"OrderDate":"1996-07-04T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":32.38,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10249,
"CustomerID":"TOMSP",
"OrderDate":"1996-07-05T00:00:00.000Z",
"ShippedDate":"1996-07-10T00:00:00.000Z",
"Freight":11.61,
"ShipName":"Toms Spezialitäten",
"ShipAddress":"Luisenstr. 48",
"ShipCity":"Münster",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10250,
"CustomerID":"HANAR",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-12T00:00:00.000Z",
"Freight":65.83,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10251,
"CustomerID":"VICTE",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":41.34,
"ShipName":"Victuailles en stock",
"ShipAddress":"2, rue du Commerce",
"ShipCity":"Lyon",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10252,
"CustomerID":"SUPRD",
"OrderDate":"1996-07-09T00:00:00.000Z",
"ShippedDate":"1996-07-11T00:00:00.000Z",
"Freight":51.3,
"ShipName":"Suprêmes délices",
"ShipAddress":"Boulevard Tirou, 255",
"ShipCity":"Charleroi",
"ShipRegion":null,
"ShipCountry":"Belgium"
},
{
"OrderID":10253,
"CustomerID":"HANAR",
"OrderDate":"1996-07-10T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":58.17,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10254,
"CustomerID":"CHOPS",
"OrderDate":"1996-07-11T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":22.98,
"ShipName":"Chop-suey Chinese",
"ShipAddress":"Hauptstr. 31",
"ShipCity":"Bern",
"ShipRegion":null,
"ShipCountry":"Switzerland",
"Verified": true
},
{
"OrderID":10255,
"CustomerID":"RICSU",
"OrderDate":"1996-07-12T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":148.33,
"ShipName":"Richter Supermarkt",
"ShipAddress":"Starenweg 5",
"ShipCity":"Genève",
"ShipRegion":null,
"ShipCountry":"Switzerland"
},
{
"OrderID":10256,
"CustomerID":"WELLI",
"OrderDate":"1996-07-15T00:00:00.000Z",
"ShippedDate":"1996-07-17T00:00:00.000Z",
"Freight":13.97,
"ShipName":"Wellington Importadora",
"ShipAddress":"Rua do Mercado, 12",
"ShipCity":"Resende",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10257,
"CustomerID":"HILAA",
"OrderDate":"1996-07-16T00:00:00.000Z",
"ShippedDate":"1996-07-22T00:00:00.000Z",
"Freight":81.91,
"ShipName":"HILARION-Abastos",
"ShipAddress":"Carrera 22 con Ave. Carlos Soublette #8-35",
"ShipCity":"San Cristóbal",
"ShipRegion":"Táchira",
"ShipCountry":"Venezuela"
},
{
"OrderID":10258,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-17T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":140.51,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"ShipCountry":"Austria"
},
{
"OrderID":10259,
"CustomerID":"CENTC",
"OrderDate":"1996-07-18T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":3.25,
"ShipName":"Centro comercial Moctezuma",
"ShipAddress":"Sierras de Granada 9993",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico",
"Verified": true
},
{
"OrderID":10260,
"CustomerID":"OTTIK",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-29T00:00:00.000Z",
"Freight":55.09,
"ShipName":"Ottilies Käseladen",
"ShipAddress":"Mehrheimerstr. 369",
"ShipCity":"Köln",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10261,
"CustomerID":"QUEDE",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-30T00:00:00.000Z",
"Freight":3.05,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10262,
"CustomerID":"RATTC",
"OrderDate":"1996-07-22T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":48.29,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA",
"Verified": true
},
{
"OrderID":10263,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-23T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":146.06,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"Verified": true,
"ShipCountry":"Austria"
},
{
"OrderID":10264,
"CustomerID":"FOLKO",
"OrderDate":"1996-07-24T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":3.67,
"ShipName":"Folk och fä HB",
"ShipAddress":"Åkergatan 24",
"ShipCity":"Bräcke",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10265,
"CustomerID":"BLONP",
"OrderDate":"1996-07-25T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":55.28,
"ShipName":"Blondel père et fils",
"ShipAddress":"24, place Kléber",
"ShipCity":"Strasbourg",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10266,
"CustomerID":"WARTH",
"OrderDate":"1996-07-26T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":25.73,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10267,
"CustomerID":"FRANK",
"OrderDate":"1996-07-29T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":208.58,
"ShipName":"Frankenversand",
"ShipAddress":"Berliner Platz 43",
"ShipCity":"München",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10268,
"CustomerID":"GROSR",
"OrderDate":"1996-07-30T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":66.29,
"ShipName":"GROSELLA-Restaurante",
"ShipAddress":"5ª Ave. Los Palos Grandes",
"ShipCity":"Caracas",
"ShipRegion":"DF",
"ShipCountry":"Venezuela"
},
{
"OrderID":10269,
"CustomerID":"WHITC",
"OrderDate":"1996-07-31T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":4.56,
"ShipName":"White Clover Markets",
"ShipAddress":"1029 - 12th Ave. S.",
"ShipCity":"Seattle",
"ShipRegion":"WA",
"ShipCountry":"USA"
},
{
"OrderID":10270,
"CustomerID":"WARTH",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":136.54,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10271,
"CustomerID":"SPLIR",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":4.54,
"ShipName":"Split Rail Beer & Ale",
"ShipAddress":"P.O. Box 555",
"ShipCity":"Lander",
"ShipRegion":"WY",
"ShipCountry":"USA"
},
{
"OrderID":10272,
"CustomerID":"RATTC",
"OrderDate":"1996-08-02T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":98.03,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
},
{
"OrderID":10273,
"CustomerID":"QUICK",
"OrderDate":"1996-08-05T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":76.07,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10274,
"CustomerID":"VINET",
"OrderDate":"1996-08-06T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":6.01,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10275,
"CustomerID":"MAGAA",
"OrderDate":"1996-08-07T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":26.93,
"ShipName":"Magazzini Alimentari Riuniti",
"ShipAddress":"Via Ludovico il Moro 22",
"ShipCity":"Bergamo",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10276,
"CustomerID":"TORTU",
"OrderDate":"1996-08-08T00:00:00.000Z",
"ShippedDate":"1996-08-14T00:00:00.000Z",
"Freight":13.84,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10277,
"CustomerID":"MORGK",
"OrderDate":"1996-08-09T00:00:00.000Z",
"ShippedDate":"1996-08-13T00:00:00.000Z",
"Freight":125.77,
"ShipName":"Morgenstern Gesundkost",
"ShipAddress":"Heerstr. 22",
"ShipCity":"Leipzig",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10278,
"CustomerID":"BERGS",
"OrderDate":"1996-08-12T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":92.69,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10279,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-13T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":25.83,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10280,
"CustomerID":"BERGS",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-09-12T00:00:00.000Z",
"Freight":8.98,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden",
"Verified": true
},
{
"OrderID":10281,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":2.94,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10282,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-15T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":12.69,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10283,
"CustomerID":"LILAS",
"OrderDate":"1996-08-16T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":84.81,
"ShipName":"LILA-Supermercado",
"ShipAddress":"Carrera 52 con Ave. Bolívar #65-98 Llano Largo",
"ShipCity":"Barquisimeto",
"ShipRegion":"Lara",
"ShipCountry":"Venezuela"
},
{
"OrderID":10284,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-19T00:00:00.000Z",
"ShippedDate":"1996-08-27T00:00:00.000Z",
"Freight":76.56,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10285,
"CustomerID":"QUICK",
"OrderDate":"1996-08-20T00:00:00.000Z",
"ShippedDate":"1996-08-26T00:00:00.000Z",
"Freight":76.83,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10286,
"CustomerID":"QUICK",
"OrderDate":"1996-08-21T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":229.24,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10287,
"CustomerID":"RICAR",
"OrderDate":"1996-08-22T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":12.76,
"ShipName":"Ricardo Adocicados",
"ShipAddress":"Av. Copacabana, 267",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10288,
"CustomerID":"REGGC",
"OrderDate":"1996-08-23T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":7.45,
"ShipName":"Reggiani Caseifici",
"ShipAddress":"Strada Provinciale 124",
"ShipCity":"Reggio Emilia",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10289,
"CustomerID":"BSBEV",
"OrderDate":"1996-08-26T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":22.77,
"ShipName":"B's Beverages",
"ShipAddress":"Fauntleroy Circus",
"ShipCity":"London",
"ShipRegion":null,
"ShipCountry":"UK"
},
{
"OrderID":10290,
"CustomerID":"COMMI",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":79.7,
"ShipName":"Comércio Mineiro",
"ShipAddress":"Av. dos Lusíadas, 23",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10291,
"CustomerID":"QUEDE",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-04T00:00:00.000Z",
"Freight":6.4,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10292,
"CustomerID":"TRADH",
"OrderDate":"1996-08-28T00:00:00.000Z",
"ShippedDate":"1996-09-02T00:00:00.000Z",
"Freight":1.35,
"ShipName":"Tradiçao Hipermercados",
"ShipAddress":"Av. Inês de Castro, 414",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10293,
"CustomerID":"TORTU",
"OrderDate":"1996-08-29T00:00:00.000Z",
"ShippedDate":"1996-09-11T00:00:00.000Z",
"Freight":21.18,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10294,
"CustomerID":"RATTC",
"OrderDate":"1996-08-30T00:00:00.000Z",
"ShippedDate":"1996-09-05T00:00:00.000Z",
"Freight":147.26,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
}];
});
The excel export provides an option to include theme for exported excel document.
To apply theme in exported Excel, define the theme in exportProperties
.
<template>
<div id="app">
<ejs-grid ref='grid' id='Grid' :dataSource='data' :toolbar='toolbarOptions' height='270px' :allowPaging='true' :allowExcelExport='true' :toolbarClick='toolbarClick'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='ShipCity' headerText='Ship City' width=150></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, Toolbar, ExcelExport } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
Vue.use(GridPlugin);
export default {
data() {
return {
data: data,
toolbarOptions: ['ExcelExport']
};
},
methods: {
toolbarClick: function(args) {
if (args.item.id === 'Grid_excelexport') { // 'Grid_excelexport' -> Grid component id + _ + toolbar item name
let excelExportProperties = {
theme:
{
header: { fontName: 'Segoe UI', fontColor: '#666666' },
record: { fontName: 'Segoe UI', fontColor: '#666666' },
caption: { fontName: 'Segoe UI', fontColor: '#666666' }
}
};
this.$refs.grid.excelExport(excelExportProperties);
}
}
},
provide: {
grid: [Toolbar, ExcelExport]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";
</style>
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.data = [
{
"OrderID":10248,
"CustomerID":"VINET",
"OrderDate":"1996-07-04T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":32.38,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10249,
"CustomerID":"TOMSP",
"OrderDate":"1996-07-05T00:00:00.000Z",
"ShippedDate":"1996-07-10T00:00:00.000Z",
"Freight":11.61,
"ShipName":"Toms Spezialitäten",
"ShipAddress":"Luisenstr. 48",
"ShipCity":"Münster",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10250,
"CustomerID":"HANAR",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-12T00:00:00.000Z",
"Freight":65.83,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10251,
"CustomerID":"VICTE",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":41.34,
"ShipName":"Victuailles en stock",
"ShipAddress":"2, rue du Commerce",
"ShipCity":"Lyon",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10252,
"CustomerID":"SUPRD",
"OrderDate":"1996-07-09T00:00:00.000Z",
"ShippedDate":"1996-07-11T00:00:00.000Z",
"Freight":51.3,
"ShipName":"Suprêmes délices",
"ShipAddress":"Boulevard Tirou, 255",
"ShipCity":"Charleroi",
"ShipRegion":null,
"ShipCountry":"Belgium"
},
{
"OrderID":10253,
"CustomerID":"HANAR",
"OrderDate":"1996-07-10T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":58.17,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10254,
"CustomerID":"CHOPS",
"OrderDate":"1996-07-11T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":22.98,
"ShipName":"Chop-suey Chinese",
"ShipAddress":"Hauptstr. 31",
"ShipCity":"Bern",
"ShipRegion":null,
"ShipCountry":"Switzerland",
"Verified": true
},
{
"OrderID":10255,
"CustomerID":"RICSU",
"OrderDate":"1996-07-12T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":148.33,
"ShipName":"Richter Supermarkt",
"ShipAddress":"Starenweg 5",
"ShipCity":"Genève",
"ShipRegion":null,
"ShipCountry":"Switzerland"
},
{
"OrderID":10256,
"CustomerID":"WELLI",
"OrderDate":"1996-07-15T00:00:00.000Z",
"ShippedDate":"1996-07-17T00:00:00.000Z",
"Freight":13.97,
"ShipName":"Wellington Importadora",
"ShipAddress":"Rua do Mercado, 12",
"ShipCity":"Resende",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10257,
"CustomerID":"HILAA",
"OrderDate":"1996-07-16T00:00:00.000Z",
"ShippedDate":"1996-07-22T00:00:00.000Z",
"Freight":81.91,
"ShipName":"HILARION-Abastos",
"ShipAddress":"Carrera 22 con Ave. Carlos Soublette #8-35",
"ShipCity":"San Cristóbal",
"ShipRegion":"Táchira",
"ShipCountry":"Venezuela"
},
{
"OrderID":10258,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-17T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":140.51,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"ShipCountry":"Austria"
},
{
"OrderID":10259,
"CustomerID":"CENTC",
"OrderDate":"1996-07-18T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":3.25,
"ShipName":"Centro comercial Moctezuma",
"ShipAddress":"Sierras de Granada 9993",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico",
"Verified": true
},
{
"OrderID":10260,
"CustomerID":"OTTIK",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-29T00:00:00.000Z",
"Freight":55.09,
"ShipName":"Ottilies Käseladen",
"ShipAddress":"Mehrheimerstr. 369",
"ShipCity":"Köln",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10261,
"CustomerID":"QUEDE",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-30T00:00:00.000Z",
"Freight":3.05,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10262,
"CustomerID":"RATTC",
"OrderDate":"1996-07-22T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":48.29,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA",
"Verified": true
},
{
"OrderID":10263,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-23T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":146.06,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"Verified": true,
"ShipCountry":"Austria"
},
{
"OrderID":10264,
"CustomerID":"FOLKO",
"OrderDate":"1996-07-24T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":3.67,
"ShipName":"Folk och fä HB",
"ShipAddress":"Åkergatan 24",
"ShipCity":"Bräcke",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10265,
"CustomerID":"BLONP",
"OrderDate":"1996-07-25T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":55.28,
"ShipName":"Blondel père et fils",
"ShipAddress":"24, place Kléber",
"ShipCity":"Strasbourg",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10266,
"CustomerID":"WARTH",
"OrderDate":"1996-07-26T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":25.73,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10267,
"CustomerID":"FRANK",
"OrderDate":"1996-07-29T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":208.58,
"ShipName":"Frankenversand",
"ShipAddress":"Berliner Platz 43",
"ShipCity":"München",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10268,
"CustomerID":"GROSR",
"OrderDate":"1996-07-30T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":66.29,
"ShipName":"GROSELLA-Restaurante",
"ShipAddress":"5ª Ave. Los Palos Grandes",
"ShipCity":"Caracas",
"ShipRegion":"DF",
"ShipCountry":"Venezuela"
},
{
"OrderID":10269,
"CustomerID":"WHITC",
"OrderDate":"1996-07-31T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":4.56,
"ShipName":"White Clover Markets",
"ShipAddress":"1029 - 12th Ave. S.",
"ShipCity":"Seattle",
"ShipRegion":"WA",
"ShipCountry":"USA"
},
{
"OrderID":10270,
"CustomerID":"WARTH",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":136.54,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10271,
"CustomerID":"SPLIR",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":4.54,
"ShipName":"Split Rail Beer & Ale",
"ShipAddress":"P.O. Box 555",
"ShipCity":"Lander",
"ShipRegion":"WY",
"ShipCountry":"USA"
},
{
"OrderID":10272,
"CustomerID":"RATTC",
"OrderDate":"1996-08-02T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":98.03,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
},
{
"OrderID":10273,
"CustomerID":"QUICK",
"OrderDate":"1996-08-05T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":76.07,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10274,
"CustomerID":"VINET",
"OrderDate":"1996-08-06T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":6.01,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10275,
"CustomerID":"MAGAA",
"OrderDate":"1996-08-07T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":26.93,
"ShipName":"Magazzini Alimentari Riuniti",
"ShipAddress":"Via Ludovico il Moro 22",
"ShipCity":"Bergamo",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10276,
"CustomerID":"TORTU",
"OrderDate":"1996-08-08T00:00:00.000Z",
"ShippedDate":"1996-08-14T00:00:00.000Z",
"Freight":13.84,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10277,
"CustomerID":"MORGK",
"OrderDate":"1996-08-09T00:00:00.000Z",
"ShippedDate":"1996-08-13T00:00:00.000Z",
"Freight":125.77,
"ShipName":"Morgenstern Gesundkost",
"ShipAddress":"Heerstr. 22",
"ShipCity":"Leipzig",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10278,
"CustomerID":"BERGS",
"OrderDate":"1996-08-12T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":92.69,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10279,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-13T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":25.83,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10280,
"CustomerID":"BERGS",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-09-12T00:00:00.000Z",
"Freight":8.98,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden",
"Verified": true
},
{
"OrderID":10281,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":2.94,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10282,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-15T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":12.69,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10283,
"CustomerID":"LILAS",
"OrderDate":"1996-08-16T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":84.81,
"ShipName":"LILA-Supermercado",
"ShipAddress":"Carrera 52 con Ave. Bolívar #65-98 Llano Largo",
"ShipCity":"Barquisimeto",
"ShipRegion":"Lara",
"ShipCountry":"Venezuela"
},
{
"OrderID":10284,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-19T00:00:00.000Z",
"ShippedDate":"1996-08-27T00:00:00.000Z",
"Freight":76.56,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10285,
"CustomerID":"QUICK",
"OrderDate":"1996-08-20T00:00:00.000Z",
"ShippedDate":"1996-08-26T00:00:00.000Z",
"Freight":76.83,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10286,
"CustomerID":"QUICK",
"OrderDate":"1996-08-21T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":229.24,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10287,
"CustomerID":"RICAR",
"OrderDate":"1996-08-22T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":12.76,
"ShipName":"Ricardo Adocicados",
"ShipAddress":"Av. Copacabana, 267",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10288,
"CustomerID":"REGGC",
"OrderDate":"1996-08-23T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":7.45,
"ShipName":"Reggiani Caseifici",
"ShipAddress":"Strada Provinciale 124",
"ShipCity":"Reggio Emilia",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10289,
"CustomerID":"BSBEV",
"OrderDate":"1996-08-26T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":22.77,
"ShipName":"B's Beverages",
"ShipAddress":"Fauntleroy Circus",
"ShipCity":"London",
"ShipRegion":null,
"ShipCountry":"UK"
},
{
"OrderID":10290,
"CustomerID":"COMMI",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":79.7,
"ShipName":"Comércio Mineiro",
"ShipAddress":"Av. dos Lusíadas, 23",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10291,
"CustomerID":"QUEDE",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-04T00:00:00.000Z",
"Freight":6.4,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10292,
"CustomerID":"TRADH",
"OrderDate":"1996-08-28T00:00:00.000Z",
"ShippedDate":"1996-09-02T00:00:00.000Z",
"Freight":1.35,
"ShipName":"Tradiçao Hipermercados",
"ShipAddress":"Av. Inês de Castro, 414",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10293,
"CustomerID":"TORTU",
"OrderDate":"1996-08-29T00:00:00.000Z",
"ShippedDate":"1996-09-11T00:00:00.000Z",
"Freight":21.18,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10294,
"CustomerID":"RATTC",
"OrderDate":"1996-08-30T00:00:00.000Z",
"ShippedDate":"1996-09-05T00:00:00.000Z",
"Freight":147.26,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
}];
});
By default, material theme is applied to exported excel document.
The excel export provides an option to include header and footer content for exported excel document.
<template>
<div id="app">
<ejs-grid ref='grid' id='Grid' :dataSource='data' :toolbar='toolbarOptions' height='270px' :allowPaging='true' :allowExcelExport='true' :toolbarClick='toolbarClick'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='ShipCity' headerText='Ship City' width=150></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, Toolbar, ExcelExport } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
Vue.use(GridPlugin);
export default {
data() {
return {
data: data,
toolbarOptions: ['ExcelExport']
};
},
methods: {
toolbarClick: function(args) {
if (args.item.id === 'Grid_excelexport') { // 'Grid_excelexport' -> Grid component id + _ + toolbar item name
let excelExportProperties = {
header: {
headerRows: 7,
rows: [
{ cells: [{ colSpan: 4, value: "Northwind Traders", style: { fontColor: '#C67878', fontSize: 20, hAlign: 'Center', bold: true, } }] },
{ cells: [{ colSpan: 4, value: "2501 Aerial Center Parkway", style: { fontColor: '#C67878', fontSize: 15, hAlign: 'Center', bold: true, } }] },
{ cells: [{ colSpan: 4, value: "Suite 200 Morrisville, NC 27560 USA", style: { fontColor: '#C67878', fontSize: 15, hAlign: 'Center', bold: true, } }] },
{ cells: [{ colSpan: 4, value: "Tel +1 888.936.8638 Fax +1 919.573.0306", style: { fontColor: '#C67878', fontSize: 15, hAlign: 'Center', bold: true, } }] },
{ cells: [{ colSpan: 4, hyperlink: { target: 'https://www.northwind.com/', displayText: 'www.northwind.com' }, style: { hAlign: 'Center' } }] },
{ cells: [{ colSpan: 4, hyperlink: { target: 'mailto:support@northwind.com' }, style: { hAlign: 'Center' } }] },
]
},
footer: {
footerRows: 4,
rows: [
{ cells: [{ colSpan: 4, value: "Thank you for your business!", style: { hAlign: 'Center', bold: true } }] },
{ cells: [{ colSpan: 4, value: "!Visit Again!", style: { hAlign: 'Center', bold: true } }] }
]
}
};
this.$refs.grid.excelExport(excelExportProperties);
}
}
},
provide: {
grid: [Toolbar, ExcelExport]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";
</style>
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.data = [
{
"OrderID":10248,
"CustomerID":"VINET",
"OrderDate":"1996-07-04T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":32.38,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10249,
"CustomerID":"TOMSP",
"OrderDate":"1996-07-05T00:00:00.000Z",
"ShippedDate":"1996-07-10T00:00:00.000Z",
"Freight":11.61,
"ShipName":"Toms Spezialitäten",
"ShipAddress":"Luisenstr. 48",
"ShipCity":"Münster",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10250,
"CustomerID":"HANAR",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-12T00:00:00.000Z",
"Freight":65.83,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10251,
"CustomerID":"VICTE",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":41.34,
"ShipName":"Victuailles en stock",
"ShipAddress":"2, rue du Commerce",
"ShipCity":"Lyon",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10252,
"CustomerID":"SUPRD",
"OrderDate":"1996-07-09T00:00:00.000Z",
"ShippedDate":"1996-07-11T00:00:00.000Z",
"Freight":51.3,
"ShipName":"Suprêmes délices",
"ShipAddress":"Boulevard Tirou, 255",
"ShipCity":"Charleroi",
"ShipRegion":null,
"ShipCountry":"Belgium"
},
{
"OrderID":10253,
"CustomerID":"HANAR",
"OrderDate":"1996-07-10T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":58.17,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10254,
"CustomerID":"CHOPS",
"OrderDate":"1996-07-11T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":22.98,
"ShipName":"Chop-suey Chinese",
"ShipAddress":"Hauptstr. 31",
"ShipCity":"Bern",
"ShipRegion":null,
"ShipCountry":"Switzerland",
"Verified": true
},
{
"OrderID":10255,
"CustomerID":"RICSU",
"OrderDate":"1996-07-12T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":148.33,
"ShipName":"Richter Supermarkt",
"ShipAddress":"Starenweg 5",
"ShipCity":"Genève",
"ShipRegion":null,
"ShipCountry":"Switzerland"
},
{
"OrderID":10256,
"CustomerID":"WELLI",
"OrderDate":"1996-07-15T00:00:00.000Z",
"ShippedDate":"1996-07-17T00:00:00.000Z",
"Freight":13.97,
"ShipName":"Wellington Importadora",
"ShipAddress":"Rua do Mercado, 12",
"ShipCity":"Resende",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10257,
"CustomerID":"HILAA",
"OrderDate":"1996-07-16T00:00:00.000Z",
"ShippedDate":"1996-07-22T00:00:00.000Z",
"Freight":81.91,
"ShipName":"HILARION-Abastos",
"ShipAddress":"Carrera 22 con Ave. Carlos Soublette #8-35",
"ShipCity":"San Cristóbal",
"ShipRegion":"Táchira",
"ShipCountry":"Venezuela"
},
{
"OrderID":10258,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-17T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":140.51,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"ShipCountry":"Austria"
},
{
"OrderID":10259,
"CustomerID":"CENTC",
"OrderDate":"1996-07-18T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":3.25,
"ShipName":"Centro comercial Moctezuma",
"ShipAddress":"Sierras de Granada 9993",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico",
"Verified": true
},
{
"OrderID":10260,
"CustomerID":"OTTIK",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-29T00:00:00.000Z",
"Freight":55.09,
"ShipName":"Ottilies Käseladen",
"ShipAddress":"Mehrheimerstr. 369",
"ShipCity":"Köln",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10261,
"CustomerID":"QUEDE",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-30T00:00:00.000Z",
"Freight":3.05,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10262,
"CustomerID":"RATTC",
"OrderDate":"1996-07-22T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":48.29,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA",
"Verified": true
},
{
"OrderID":10263,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-23T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":146.06,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"Verified": true,
"ShipCountry":"Austria"
},
{
"OrderID":10264,
"CustomerID":"FOLKO",
"OrderDate":"1996-07-24T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":3.67,
"ShipName":"Folk och fä HB",
"ShipAddress":"Åkergatan 24",
"ShipCity":"Bräcke",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10265,
"CustomerID":"BLONP",
"OrderDate":"1996-07-25T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":55.28,
"ShipName":"Blondel père et fils",
"ShipAddress":"24, place Kléber",
"ShipCity":"Strasbourg",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10266,
"CustomerID":"WARTH",
"OrderDate":"1996-07-26T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":25.73,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10267,
"CustomerID":"FRANK",
"OrderDate":"1996-07-29T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":208.58,
"ShipName":"Frankenversand",
"ShipAddress":"Berliner Platz 43",
"ShipCity":"München",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10268,
"CustomerID":"GROSR",
"OrderDate":"1996-07-30T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":66.29,
"ShipName":"GROSELLA-Restaurante",
"ShipAddress":"5ª Ave. Los Palos Grandes",
"ShipCity":"Caracas",
"ShipRegion":"DF",
"ShipCountry":"Venezuela"
},
{
"OrderID":10269,
"CustomerID":"WHITC",
"OrderDate":"1996-07-31T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":4.56,
"ShipName":"White Clover Markets",
"ShipAddress":"1029 - 12th Ave. S.",
"ShipCity":"Seattle",
"ShipRegion":"WA",
"ShipCountry":"USA"
},
{
"OrderID":10270,
"CustomerID":"WARTH",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":136.54,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10271,
"CustomerID":"SPLIR",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":4.54,
"ShipName":"Split Rail Beer & Ale",
"ShipAddress":"P.O. Box 555",
"ShipCity":"Lander",
"ShipRegion":"WY",
"ShipCountry":"USA"
},
{
"OrderID":10272,
"CustomerID":"RATTC",
"OrderDate":"1996-08-02T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":98.03,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
},
{
"OrderID":10273,
"CustomerID":"QUICK",
"OrderDate":"1996-08-05T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":76.07,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10274,
"CustomerID":"VINET",
"OrderDate":"1996-08-06T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":6.01,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10275,
"CustomerID":"MAGAA",
"OrderDate":"1996-08-07T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":26.93,
"ShipName":"Magazzini Alimentari Riuniti",
"ShipAddress":"Via Ludovico il Moro 22",
"ShipCity":"Bergamo",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10276,
"CustomerID":"TORTU",
"OrderDate":"1996-08-08T00:00:00.000Z",
"ShippedDate":"1996-08-14T00:00:00.000Z",
"Freight":13.84,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10277,
"CustomerID":"MORGK",
"OrderDate":"1996-08-09T00:00:00.000Z",
"ShippedDate":"1996-08-13T00:00:00.000Z",
"Freight":125.77,
"ShipName":"Morgenstern Gesundkost",
"ShipAddress":"Heerstr. 22",
"ShipCity":"Leipzig",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10278,
"CustomerID":"BERGS",
"OrderDate":"1996-08-12T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":92.69,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10279,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-13T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":25.83,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10280,
"CustomerID":"BERGS",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-09-12T00:00:00.000Z",
"Freight":8.98,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden",
"Verified": true
},
{
"OrderID":10281,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":2.94,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10282,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-15T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":12.69,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10283,
"CustomerID":"LILAS",
"OrderDate":"1996-08-16T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":84.81,
"ShipName":"LILA-Supermercado",
"ShipAddress":"Carrera 52 con Ave. Bolívar #65-98 Llano Largo",
"ShipCity":"Barquisimeto",
"ShipRegion":"Lara",
"ShipCountry":"Venezuela"
},
{
"OrderID":10284,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-19T00:00:00.000Z",
"ShippedDate":"1996-08-27T00:00:00.000Z",
"Freight":76.56,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10285,
"CustomerID":"QUICK",
"OrderDate":"1996-08-20T00:00:00.000Z",
"ShippedDate":"1996-08-26T00:00:00.000Z",
"Freight":76.83,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10286,
"CustomerID":"QUICK",
"OrderDate":"1996-08-21T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":229.24,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10287,
"CustomerID":"RICAR",
"OrderDate":"1996-08-22T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":12.76,
"ShipName":"Ricardo Adocicados",
"ShipAddress":"Av. Copacabana, 267",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10288,
"CustomerID":"REGGC",
"OrderDate":"1996-08-23T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":7.45,
"ShipName":"Reggiani Caseifici",
"ShipAddress":"Strada Provinciale 124",
"ShipCity":"Reggio Emilia",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10289,
"CustomerID":"BSBEV",
"OrderDate":"1996-08-26T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":22.77,
"ShipName":"B's Beverages",
"ShipAddress":"Fauntleroy Circus",
"ShipCity":"London",
"ShipRegion":null,
"ShipCountry":"UK"
},
{
"OrderID":10290,
"CustomerID":"COMMI",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":79.7,
"ShipName":"Comércio Mineiro",
"ShipAddress":"Av. dos Lusíadas, 23",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10291,
"CustomerID":"QUEDE",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-04T00:00:00.000Z",
"Freight":6.4,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10292,
"CustomerID":"TRADH",
"OrderDate":"1996-08-28T00:00:00.000Z",
"ShippedDate":"1996-09-02T00:00:00.000Z",
"Freight":1.35,
"ShipName":"Tradiçao Hipermercados",
"ShipAddress":"Av. Inês de Castro, 414",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10293,
"CustomerID":"TORTU",
"OrderDate":"1996-08-29T00:00:00.000Z",
"ShippedDate":"1996-09-11T00:00:00.000Z",
"Freight":21.18,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10294,
"CustomerID":"RATTC",
"OrderDate":"1996-08-30T00:00:00.000Z",
"ShippedDate":"1996-09-05T00:00:00.000Z",
"Freight":147.26,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
}];
});
You can assign the file name for the exported document by defining fileName property in excelExportProperties
.
<template>
<div id="app">
<ejs-grid ref='grid' id='Grid' :dataSource='data' :toolbar='toolbarOptions' height='270px' :allowPaging='true' :allowExcelExport='true' :toolbarClick='toolbarClick'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='ShipCity' headerText='Ship City' width=150></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, Toolbar, ExcelExport } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
Vue.use(GridPlugin);
export default {
data() {
return {
data: data,
toolbarOptions: ['ExcelExport']
};
},
methods: {
toolbarClick: function(args) {
if (args.item.id === 'Grid_excelexport') { // 'Grid_excelexport' -> Grid component id + _ + toolbar item name
let excelExportProperties = {
fileName:"new.xlsx"
};
this.$refs.grid.excelExport(excelExportProperties);
}
}
},
provide: {
grid: [Toolbar, ExcelExport]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";
</style>
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.data = [
{
"OrderID":10248,
"CustomerID":"VINET",
"OrderDate":"1996-07-04T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":32.38,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10249,
"CustomerID":"TOMSP",
"OrderDate":"1996-07-05T00:00:00.000Z",
"ShippedDate":"1996-07-10T00:00:00.000Z",
"Freight":11.61,
"ShipName":"Toms Spezialitäten",
"ShipAddress":"Luisenstr. 48",
"ShipCity":"Münster",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10250,
"CustomerID":"HANAR",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-12T00:00:00.000Z",
"Freight":65.83,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10251,
"CustomerID":"VICTE",
"OrderDate":"1996-07-08T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":41.34,
"ShipName":"Victuailles en stock",
"ShipAddress":"2, rue du Commerce",
"ShipCity":"Lyon",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10252,
"CustomerID":"SUPRD",
"OrderDate":"1996-07-09T00:00:00.000Z",
"ShippedDate":"1996-07-11T00:00:00.000Z",
"Freight":51.3,
"ShipName":"Suprêmes délices",
"ShipAddress":"Boulevard Tirou, 255",
"ShipCity":"Charleroi",
"ShipRegion":null,
"ShipCountry":"Belgium"
},
{
"OrderID":10253,
"CustomerID":"HANAR",
"OrderDate":"1996-07-10T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":58.17,
"ShipName":"Hanari Carnes",
"ShipAddress":"Rua do Paço, 67",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil",
"Verified": true
},
{
"OrderID":10254,
"CustomerID":"CHOPS",
"OrderDate":"1996-07-11T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":22.98,
"ShipName":"Chop-suey Chinese",
"ShipAddress":"Hauptstr. 31",
"ShipCity":"Bern",
"ShipRegion":null,
"ShipCountry":"Switzerland",
"Verified": true
},
{
"OrderID":10255,
"CustomerID":"RICSU",
"OrderDate":"1996-07-12T00:00:00.000Z",
"ShippedDate":"1996-07-15T00:00:00.000Z",
"Freight":148.33,
"ShipName":"Richter Supermarkt",
"ShipAddress":"Starenweg 5",
"ShipCity":"Genève",
"ShipRegion":null,
"ShipCountry":"Switzerland"
},
{
"OrderID":10256,
"CustomerID":"WELLI",
"OrderDate":"1996-07-15T00:00:00.000Z",
"ShippedDate":"1996-07-17T00:00:00.000Z",
"Freight":13.97,
"ShipName":"Wellington Importadora",
"ShipAddress":"Rua do Mercado, 12",
"ShipCity":"Resende",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10257,
"CustomerID":"HILAA",
"OrderDate":"1996-07-16T00:00:00.000Z",
"ShippedDate":"1996-07-22T00:00:00.000Z",
"Freight":81.91,
"ShipName":"HILARION-Abastos",
"ShipAddress":"Carrera 22 con Ave. Carlos Soublette #8-35",
"ShipCity":"San Cristóbal",
"ShipRegion":"Táchira",
"ShipCountry":"Venezuela"
},
{
"OrderID":10258,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-17T00:00:00.000Z",
"ShippedDate":"1996-07-23T00:00:00.000Z",
"Freight":140.51,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"ShipCountry":"Austria"
},
{
"OrderID":10259,
"CustomerID":"CENTC",
"OrderDate":"1996-07-18T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":3.25,
"ShipName":"Centro comercial Moctezuma",
"ShipAddress":"Sierras de Granada 9993",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico",
"Verified": true
},
{
"OrderID":10260,
"CustomerID":"OTTIK",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-29T00:00:00.000Z",
"Freight":55.09,
"ShipName":"Ottilies Käseladen",
"ShipAddress":"Mehrheimerstr. 369",
"ShipCity":"Köln",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10261,
"CustomerID":"QUEDE",
"OrderDate":"1996-07-19T00:00:00.000Z",
"ShippedDate":"1996-07-30T00:00:00.000Z",
"Freight":3.05,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10262,
"CustomerID":"RATTC",
"OrderDate":"1996-07-22T00:00:00.000Z",
"ShippedDate":"1996-07-25T00:00:00.000Z",
"Freight":48.29,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA",
"Verified": true
},
{
"OrderID":10263,
"CustomerID":"ERNSH",
"OrderDate":"1996-07-23T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":146.06,
"ShipName":"Ernst Handel",
"ShipAddress":"Kirchgasse 6",
"ShipCity":"Graz",
"ShipRegion":null,
"Verified": true,
"ShipCountry":"Austria"
},
{
"OrderID":10264,
"CustomerID":"FOLKO",
"OrderDate":"1996-07-24T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":3.67,
"ShipName":"Folk och fä HB",
"ShipAddress":"Åkergatan 24",
"ShipCity":"Bräcke",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10265,
"CustomerID":"BLONP",
"OrderDate":"1996-07-25T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":55.28,
"ShipName":"Blondel père et fils",
"ShipAddress":"24, place Kléber",
"ShipCity":"Strasbourg",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10266,
"CustomerID":"WARTH",
"OrderDate":"1996-07-26T00:00:00.000Z",
"ShippedDate":"1996-07-31T00:00:00.000Z",
"Freight":25.73,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10267,
"CustomerID":"FRANK",
"OrderDate":"1996-07-29T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":208.58,
"ShipName":"Frankenversand",
"ShipAddress":"Berliner Platz 43",
"ShipCity":"München",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10268,
"CustomerID":"GROSR",
"OrderDate":"1996-07-30T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":66.29,
"ShipName":"GROSELLA-Restaurante",
"ShipAddress":"5ª Ave. Los Palos Grandes",
"ShipCity":"Caracas",
"ShipRegion":"DF",
"ShipCountry":"Venezuela"
},
{
"OrderID":10269,
"CustomerID":"WHITC",
"OrderDate":"1996-07-31T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":4.56,
"ShipName":"White Clover Markets",
"ShipAddress":"1029 - 12th Ave. S.",
"ShipCity":"Seattle",
"ShipRegion":"WA",
"ShipCountry":"USA"
},
{
"OrderID":10270,
"CustomerID":"WARTH",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-02T00:00:00.000Z",
"Freight":136.54,
"ShipName":"Wartian Herkku",
"ShipAddress":"Torikatu 38",
"ShipCity":"Oulu",
"ShipRegion":null,
"ShipCountry":"Finland"
},
{
"OrderID":10271,
"CustomerID":"SPLIR",
"OrderDate":"1996-08-01T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":4.54,
"ShipName":"Split Rail Beer & Ale",
"ShipAddress":"P.O. Box 555",
"ShipCity":"Lander",
"ShipRegion":"WY",
"ShipCountry":"USA"
},
{
"OrderID":10272,
"CustomerID":"RATTC",
"OrderDate":"1996-08-02T00:00:00.000Z",
"ShippedDate":"1996-08-06T00:00:00.000Z",
"Freight":98.03,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
},
{
"OrderID":10273,
"CustomerID":"QUICK",
"OrderDate":"1996-08-05T00:00:00.000Z",
"ShippedDate":"1996-08-12T00:00:00.000Z",
"Freight":76.07,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10274,
"CustomerID":"VINET",
"OrderDate":"1996-08-06T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":6.01,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France"
},
{
"OrderID":10275,
"CustomerID":"MAGAA",
"OrderDate":"1996-08-07T00:00:00.000Z",
"ShippedDate":"1996-08-09T00:00:00.000Z",
"Freight":26.93,
"ShipName":"Magazzini Alimentari Riuniti",
"ShipAddress":"Via Ludovico il Moro 22",
"ShipCity":"Bergamo",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10276,
"CustomerID":"TORTU",
"OrderDate":"1996-08-08T00:00:00.000Z",
"ShippedDate":"1996-08-14T00:00:00.000Z",
"Freight":13.84,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10277,
"CustomerID":"MORGK",
"OrderDate":"1996-08-09T00:00:00.000Z",
"ShippedDate":"1996-08-13T00:00:00.000Z",
"Freight":125.77,
"ShipName":"Morgenstern Gesundkost",
"ShipAddress":"Heerstr. 22",
"ShipCity":"Leipzig",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10278,
"CustomerID":"BERGS",
"OrderDate":"1996-08-12T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":92.69,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden"
},
{
"OrderID":10279,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-13T00:00:00.000Z",
"ShippedDate":"1996-08-16T00:00:00.000Z",
"Freight":25.83,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10280,
"CustomerID":"BERGS",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-09-12T00:00:00.000Z",
"Freight":8.98,
"ShipName":"Berglunds snabbköp",
"ShipAddress":"Berguvsvägen 8",
"ShipCity":"Luleå",
"ShipRegion":null,
"ShipCountry":"Sweden",
"Verified": true
},
{
"OrderID":10281,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-14T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":2.94,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10282,
"CustomerID":"ROMEY",
"OrderDate":"1996-08-15T00:00:00.000Z",
"ShippedDate":"1996-08-21T00:00:00.000Z",
"Freight":12.69,
"ShipName":"Romero y tomillo",
"ShipAddress":"Gran Vía, 1",
"ShipCity":"Madrid",
"ShipRegion":null,
"ShipCountry":"Spain"
},
{
"OrderID":10283,
"CustomerID":"LILAS",
"OrderDate":"1996-08-16T00:00:00.000Z",
"ShippedDate":"1996-08-23T00:00:00.000Z",
"Freight":84.81,
"ShipName":"LILA-Supermercado",
"ShipAddress":"Carrera 52 con Ave. Bolívar #65-98 Llano Largo",
"ShipCity":"Barquisimeto",
"ShipRegion":"Lara",
"ShipCountry":"Venezuela"
},
{
"OrderID":10284,
"CustomerID":"LEHMS",
"OrderDate":"1996-08-19T00:00:00.000Z",
"ShippedDate":"1996-08-27T00:00:00.000Z",
"Freight":76.56,
"ShipName":"Lehmanns Marktstand",
"ShipAddress":"Magazinweg 7",
"ShipCity":"Frankfurt a.M.",
"ShipRegion":null,
"ShipCountry":"Germany",
"Verified": true
},
{
"OrderID":10285,
"CustomerID":"QUICK",
"OrderDate":"1996-08-20T00:00:00.000Z",
"ShippedDate":"1996-08-26T00:00:00.000Z",
"Freight":76.83,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10286,
"CustomerID":"QUICK",
"OrderDate":"1996-08-21T00:00:00.000Z",
"ShippedDate":"1996-08-30T00:00:00.000Z",
"Freight":229.24,
"ShipName":"QUICK-Stop",
"ShipAddress":"Taucherstraße 10",
"ShipCity":"Cunewalde",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10287,
"CustomerID":"RICAR",
"OrderDate":"1996-08-22T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":12.76,
"ShipName":"Ricardo Adocicados",
"ShipAddress":"Av. Copacabana, 267",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10288,
"CustomerID":"REGGC",
"OrderDate":"1996-08-23T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":7.45,
"ShipName":"Reggiani Caseifici",
"ShipAddress":"Strada Provinciale 124",
"ShipCity":"Reggio Emilia",
"ShipRegion":null,
"ShipCountry":"Italy"
},
{
"OrderID":10289,
"CustomerID":"BSBEV",
"OrderDate":"1996-08-26T00:00:00.000Z",
"ShippedDate":"1996-08-28T00:00:00.000Z",
"Freight":22.77,
"ShipName":"B's Beverages",
"ShipAddress":"Fauntleroy Circus",
"ShipCity":"London",
"ShipRegion":null,
"ShipCountry":"UK"
},
{
"OrderID":10290,
"CustomerID":"COMMI",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-03T00:00:00.000Z",
"Freight":79.7,
"ShipName":"Comércio Mineiro",
"ShipAddress":"Av. dos Lusíadas, 23",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10291,
"CustomerID":"QUEDE",
"OrderDate":"1996-08-27T00:00:00.000Z",
"ShippedDate":"1996-09-04T00:00:00.000Z",
"Freight":6.4,
"ShipName":"Que Delícia",
"ShipAddress":"Rua da Panificadora, 12",
"ShipCity":"Rio de Janeiro",
"ShipRegion":"RJ",
"ShipCountry":"Brazil"
},
{
"OrderID":10292,
"CustomerID":"TRADH",
"OrderDate":"1996-08-28T00:00:00.000Z",
"ShippedDate":"1996-09-02T00:00:00.000Z",
"Freight":1.35,
"ShipName":"Tradiçao Hipermercados",
"ShipAddress":"Av. Inês de Castro, 414",
"ShipCity":"Sao Paulo",
"ShipRegion":"SP",
"ShipCountry":"Brazil"
},
{
"OrderID":10293,
"CustomerID":"TORTU",
"OrderDate":"1996-08-29T00:00:00.000Z",
"ShippedDate":"1996-09-11T00:00:00.000Z",
"Freight":21.18,
"ShipName":"Tortuga Restaurante",
"ShipAddress":"Avda. Azteca 123",
"ShipCity":"México D.F.",
"ShipRegion":null,
"ShipCountry":"Mexico"
},
{
"OrderID":10294,
"CustomerID":"RATTC",
"OrderDate":"1996-08-30T00:00:00.000Z",
"ShippedDate":"1996-09-05T00:00:00.000Z",
"Freight":147.26,
"ShipName":"Rattlesnake Canyon Grocery",
"ShipAddress":"2817 Milton Dr.",
"ShipCity":"Albuquerque",
"ShipRegion":"NM",
"ShipCountry":"USA"
}];
});
The excel export provides an option to define datasource dynamically before exporting.
To export data dynamically, define the dataSource in excelExportProperties
.
<template>
<div id="app">
<ejs-grid ref='grid' id='Grid' :dataSource='data' :toolbar='toolbarOptions' height='270px' :allowPaging='true' :allowExcelExport='true' :toolbarClick='toolbarClick'>
<e-columns>
<e-column field='OrderID' headerText='Order ID' textAlign='Right' width=120></e-column>
<e-column field='CustomerID' headerText='Customer ID' width=150></e-column>
<e-column field='ShipCity' headerText='Ship City' width=150></e-column>
<e-column field='ShipName' headerText='Ship Name' width=150></e-column>
</e-columns>
</ejs-grid>
</div>
</template>
<script>
import Vue from "vue";
import { GridPlugin, Toolbar, ExcelExport } from "@syncfusion/ej2-vue-grids";
import { data } from './datasource.js';
Vue.use(GridPlugin);
export default {
data() {
return {
data: data,
toolbarOptions: ['ExcelExport']
};
},
methods: {
toolbarClick: function(args) {
if (args.item.id === 'Grid_excelexport') { // 'Grid_excelexport' -> Grid component id + _ + toolbar item name
let excelExportProperties = {
dataSource: data
};
this.$refs.grid.excelExport(excelExportProperties);
}
}
},
provide: {
grid: [Toolbar, ExcelExport]
}
}
</script>
<style>
@import "../node_modules/@syncfusion/ej2-vue-grids/styles/material.css";
</style>
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.data = [
{
"OrderID":10248,
"CustomerID":"VINET",
"OrderDate":"1996-07-04T00:00:00.000Z",
"ShippedDate":"1996-07-16T00:00:00.000Z",
"Freight":32.38,
"ShipName":"Vins et alcools Chevalier",
"ShipAddress":"59 rue de l'Abbaye",
"ShipCity":"Reims",
"ShipRegion":null,
"ShipCountry":"France",
"Verified": true
},
{
"OrderID":10249,
"CustomerID":"TOMSP",
"OrderDate":"1996-07-05T00:00:00.000Z",
"ShippedDate":"1996-07-10T00:00:00.000Z",
"Freight":11.61,
"ShipName":"Toms Spezialitäten",
"ShipAddress":"Luisenstr. 48",
"ShipCity":"Münster",
"ShipRegion":null,
"ShipCountry":"Germany"
},
{
"OrderID":10250,
"CustomerID":"HANAR"