The igGridExcelExport permits exporting a grid to a new Excel file. Is it possible to add the data as a worksheet to an existing Excel file?
Hi Ray,
I found another more clean approach for exporting the grid to an existing excel file, without iterating through the whole worksheet.You can bind to the headerCellExporting event of the igGridExcelExporter and add the following code snippet:
headerCellExporting: function(sender, args) { var headerArr = []; // 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._worksheet = sender._workbook.worksheets(1); } }
Here is a sample for your reference:
igGridExcelExportToExistingFile (2).zip
Please, let me know if you have any questions.
Best regards,Hristo Popov
This last technique works very well, although the header columns for the worksheet created do not have the grid header names. I assume the headerArr was going to be used to correct this, but it wasn't shown how in the sample. However, I was able to call a function we already had to set the header exactly as required.
Thank you for your assistance.