Hi,
Is it possible to export multiple grids to the same excel file?
Each grid will be on a different sheet.
This feature is available in the ASP.NET excel export, as you can use the Export method, and pass it the grid to be exported and an Excel sheet.
Thanks
Thank you for using our forum.
Yes, it is possible to export 2 grids in same excel file.
You can look at our sample:
https://es.infragistics.com/samples/aspnet/data-grid/excel-exporter
Thanks for the quick response.
I was asking about exporting the igGrid - the javascript control, not the ASP.NET server control.
thanks
Hi Tufail,
Each grid is exported into a table region in a worksheet, but Excel allows only one table region to be created within a single worksheet, so trying to export second grid into the same sheet will result in an error:
"There in another table in the specified region."
The URL talks about exporting 2 iGGrids into two separate sheets. Is there a way to combine two igGrids into one single sheet.
Please refer to https://es.infragistics.com/community/forums/f/ignite-ui-for-javascript/104362/export-multiple-grids-to-one-excel-file/493792#493792 for an overview of how to export to grids into the same worksheet.
Is there any way to export two igGrids into single sheet within a workbook.
Managed to fix this myself after a bit of R&D. Posting complete code below (please excuse formatting)
function exportSecondGrid(workbook) { var headerArr = []; $.ig.GridExcelExporter.exportGrid($("#grid1"), { fileName: "igGrid", worksheetName: "Sheet2" }, { headerCellExporting: function(sender, args) {// We will save all the headers coming to our array for retrieval later on headerArr.push(args.headerText); if (args.columnIndex === 0) { sender._workbook = workbook; sender._workbook.worksheets().add( sender._worksheet.name()); sender._worksheet = sender._workbook.worksheets(1); } }, exportEnding: function(sender, args) { // Now use the array of headers to be updated var row = sender._worksheet.rows(0); for(var ind=0; ind < headerArr.length; ind++) { row.setCellValue(ind, headerArr[ind]); } } } );
}
Use this with the original first function and everything will be perfect