Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
130
pivotgrid header export
posted

Hi,

I'm using the $.ig.GridExcelExporter.exportGrid to export a pivot grid.

It works but it exports only data, without left headers. On the top I have 2 rows of header and the exporter gets only one row.

Is there a way to export the headers too?

(Wher I use the exportere on a iggrid with grouped header it get only one row too)

  • 23953
    Offline posted

    Hello Giovanni,

     

    I'm afraid that the $.ig.GridExcelExporter does not support exporting an igPivotGrid. Also regarding the igGrid the $.ig.GridExcelExporter does not support exporting Multi-Column Headers feature. That's the reason you see this behavior. However you should be able to add the multi headers and left headers in the exportEnding event where you can use the args.worksheet to access the Excel Engine API. Here is an example code that demonstrates inserting a multi header:

     

     

    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)")); }
    
    }

    Best regards,

    Martin Pavlov
    Infragistics, Inc.