Skip to content
jQuery plugin to export the entire data from slick grid to excel. A client side javascript, jquery plugin to export slick grid to excel.
JavaScript HTML CSS
Branch: master
Clone or download
Latest commit e33fb9f Feb 22, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
controls Files Updated Feb 22, 2016
css/smoothness Files Updated Feb 22, 2016
dist Files Updated Feb 22, 2016
examples Files Updated Feb 22, 2016
images Files Updated Feb 22, 2016
lib Files Updated Feb 22, 2016
plugins Files Updated Feb 22, 2016
tests Files Updated Feb 22, 2016
.gitignore Files Updated Feb 22, 2016
MIT-LICENSE.txt Files Updated Feb 22, 2016
README.md updated Feb 22, 2016
index.html Files Updated Feb 22, 2016
slick-default-theme.css Files Updated Feb 22, 2016
slick.core.js Files Updated Feb 22, 2016
slick.dataview.js Files Updated Feb 22, 2016
slick.editors.js Files Updated Feb 22, 2016
slick.formatters.js Files Updated Feb 22, 2016
slick.grid.css Files Updated Feb 22, 2016
slick.grid.js Files Updated Feb 22, 2016
slick.groupitemmetadataprovider.js Files Updated Feb 22, 2016
slick.remotemodel.js Files Updated Feb 22, 2016

README.md

Slickgrid Export to Excel

jQuery plugin to export the entire data from slick grid to excel. A client side javascript, jquery plugin to export slick grid to excel.

Usage

  • Include all the files inside the dist as it is in your application (dont call all js in your html page)
  • Include require, underscore and jquery.slickgrid.export.excel js files in the html page
	<!-- add the following js files for Excel Exporting-->
    <script src="js/require.js"></script>
    <script src="js/underscore.js"></script>
    <script src="jquery.slickgrid.export.excel.js"></script>
  • Configure the location of the js files as mentioned below
	<script>
		requirejs.config({
			baseUrl: '/examples/js'  //give the location of the folder which contains require, excel-builder, etc
		});
	</script>
  • Now call the jquery plugin after building the slick grid
	<script>
		grid = new Slick.Grid("#myGrid", data, columns, options); // you will use this line to add your data to slick grid
		
		// after this line call the export to excel plugin
		$('body').exportToExcel("Report.xlsx", "Report", data, excelOptions, function (response) {
			console.log(response);
		});
	</script>

Syntax for export to excel plugin

<script>
	$('body').exportToExcel(fileName.xlsx, excelWorksheetName, data, excelOptions, function (response) {
        console.log(response); // response gives base 64 content of the excel file name
    });
	
	fileName -> name of the file to be downloaded
	excelWorksheetName  -> name of the excel work sheet name
	data  -> same data parameter passed in Slick.grid
	excelOptions  -> option to format the cell styles and header styles
	callback() -> an call back function
</script>
  • excelOptions
	//default formatting options
	excelOptions = {  
      headerStyle: {
          font: {
              bold: true,  //enable bold
              font: 12, // font size
              color: '00ffffff' //font color --Note: Add 00 before the color code
          },
          fill: {   //fill background
              type: 'pattern', 
              patternType: 'solid',
              fgColor: '00428BCA' //background color --Note: Add 00 before the color code
          }
      },
      cellStyle: {
          font: {
              bold: false,  //enable bold
              font: 12, // font size
              color: '00000000' //font color --Note: Add 00 before the color code
          },
          fill: {   //fill background
              type: 'pattern',
              patternType: 'solid',
              fgColor: '00ffffff' //background color --Note: Add 00 before the color code
          }
      },
  };
  //if excelOptions was not loaded, then the excel will be built with above default formatting
  • Give the Download button id='downloadlink'
  • It will automatically add the base 64 content in its href attribute

Examples

  • Open the examples folder, to find html pages included with our plugin
  • Click the download excel button to download the excel file.

Plugins used

  • require
  • jsZip
  • underscore
  • swfobject
  • excel builder

About Author

I am passionate in playing with pixels, creating attractive designs which interact well with the user and love developing web apps. Have a good background in web design and development. Also having wonderful working experience with various interesting projects and participated in the development of the products to provide end to end solutions.

License

Released under the MIT license.

You can’t perform that action at this time.