Bug in export flexGrid to xlsx

Posted by: arq2002 on 15 July 2022, 2:17 am EST

  • Posted 15 July 2022, 2:17 am EST

    Hi,

    When flexGrid has both rows and columns frozen, then after export to excel, only frozen rows appear in excel.

    The bug is in file @grapecity\wijmo.xlsx\index.js

    
     _xlsx._generateSheetGlobalSetting = function(e, t, o) {
            var r = t.rows && t.rows[0] && t.rows[0].cells ? t.rows[0].cells.length : 0,
                l = ' xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"';
            this._sheetHasNotes(e) && (l += ' xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"');
            l += ' xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">';
            l += '<sheetPr><outlinePr summaryBelow="0"/></sheetPr>';
            l += '<dimension ref="A1' + (r > 0 ? ":" + this._numAlpha(r - 1) + t.rows.length : "") + '"/>';
            l += '<sheetViews><sheetView workbookViewId="0"';
            e === o.activeWorksheet && (l += ' tabSelected="1"');
            var i = 0,
                s = 0;
            if (t.frozenPane && ((i = t.frozenPane.rows || 0) | (s = t.frozenPane.columns || 0))) {
                l += ">";
                l += '<pane state="frozen" activePane="' + (0 !== i && 0 !== s ? "bottomRight" : 0 !== i ? "bottomLeft" : "topRight") + '" topLeftCell="' + (this._numAlpha(s) + (i + 1)) + '" ySplit="' + i.toString() + '" xSplit="' + s.toString() + '"/>';
                l += "</sheetView>"
            } else l += "/>";
            l += "</sheetViews>";
            return l += '<sheetFormatPr defaultRowHeight="15" x14ac:dyDescent="0.25"/>'
        };
    
    

    see line:

    
     if (t.frozenPane && ((i = t.frozenPane.rows || 0) || (s = t.frozenPane.columns || 0)))
    
    

    should be:

    
     if (t.frozenPane && ((i = t.frozenPane.rows || 0) | (s = t.frozenPane.columns || 0)))
    
    

    becouse when t.frozenPane.rows != 0 then s is not set.

    Second bug is when in export options we ommited some frozen columns, eg:

    
    
    grid.frozenColumns = 4;
    
    var options =
            {
                includeColumnHeaders: true,
                formatItem: exportFormatItem,
                includeColumns: function (column) { return column.index !== 1 && column.index !== 3; }
            }
    
    
  • Posted 15 July 2022, 2:44 am EST

    Sorry, should be:

    
     if (t.frozenPane && ((i = t.frozenPane.rows || 0) || (s = t.frozenPane.columns || 0))) {
    s = t.frozenPane.columns;    //  <-- again becouse s is not set
    ...
    }
    
    
  • Posted 18 July 2022, 9:48 pm EST

    Hi,

    Thank you for reporting the issue. We are able to replicate both the issues and hence we have escalated it to the dev team for further investigation(WJM-24491). We will keep posting updates on this thread.

    Regards

    Sharad

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels