将UI导出点击为具有多列标题的Excel表

我在我的网站上使用Ignite UI来查看表格,我需要将其导出到excel。 我正在使用默认的Infragistrictsfunction$.ig.GridExcelExporter.exportGrid ,但我得到表只有标题的下半部分。 我有多列标题,我只得到下半部分。 有没有办法解决它?

在这里输入图像说明

igGridExcelExporter不处理MultiColumnHeaders。 此外,网格导出到工作表内的表区域,不允许单元格合并。 这意味着你可以通过在exportEnding事件中插入一个新行并合并单元格来模拟多头信息:

 exportEnding: function(sender, args) { args.worksheet.rows().insert(0, 1); // insert one new row at index 0 //create a merged cells region that will act as a multi header var mergedHeaderRegion = args.worksheet.mergedCellsRegions().add(0,1,0,2); // firstRowIndex, firstColumnIndex, lastRowIndex, lastColumnIndex mergedHeaderRegion.value("Month1"); // style the newly inserted row as a header for (var columnIndex = 0; columnIndex < 4; columnIndex++) { args.worksheet.rows(0).getCellFormat(columnIndex).fill($.ig.excel.CellFill.createSolidFill("rgb(136, 136, 136)")); args.worksheet.rows(0).getCellFormat(columnIndex).font().colorInfo(new $.ig.excel.WorkbookColorInfo("rgb(255, 255, 255)")); } } 

您也可以参考以下帮助主题和API文档:

http://www.igniteui.com/help/javascript-excel-library-merge-cells

http://help.infragistics.com/jQuery/2015.2/