From b971f4177cf19666f420eb5f70fbe774c33fd137 Mon Sep 17 00:00:00 2001 From: Kevin Clark Date: Thu, 19 Apr 2018 14:08:39 -0500 Subject: [PATCH] fix(exporter.js): Fix export when selection col is hidden. (#6676) --- src/features/exporter/js/exporter.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/features/exporter/js/exporter.js b/src/features/exporter/js/exporter.js index 76d429a0a6..16576a9992 100755 --- a/src/features/exporter/js/exporter.js +++ b/src/features/exporter/js/exporter.js @@ -61,12 +61,14 @@ */ module.constant('uiGridExporterConstants', { featureName: 'exporter', + rowHeaderColName: 'treeBaseRowHeaderCol', ALL: 'all', VISIBLE: 'visible', SELECTED: 'selected', CSV_CONTENT: 'CSV_CONTENT', BUTTON_LABEL: 'BUTTON_LABEL', - FILE_NAME: 'FILE_NAME' + FILE_NAME: 'FILE_NAME', + PIXEL_PER_UNIT: 75 }); /** @@ -1533,9 +1535,11 @@ // The standard column width in Microsoft Excel 2000 is 8.43 characters based on fixed-width Courier font // Width of 10 in excel is 75 pixels var colWidths = []; - var startDataIndex = grid.treeBase ? grid.treeBase.numberLevels : (grid.enableRowSelection !== false ? 1 : 0); + var startDataIndex = grid.treeBase ? grid.treeBase.numberLevels : (grid.enableRowSelection ? 1 : 0); for (var i = startDataIndex; i < grid.columns.length; i++) { - colWidths.push({width: (grid.columns[i].drawnWidth / 75) * 10}); + if (grid.columns[i].field !== uiGridExporterConstants.rowHeaderColName) { + colWidths.push({width: (grid.columns[i].drawnWidth / uiGridExporterConstants.PIXEL_PER_UNIT) * 10}); + } } sheet.setColumns(colWidths);