Skip to content

Commit b971f41

Browse files
monster910mportuga
authored andcommitted
fix(exporter.js): Fix export when selection col is hidden. (#6676)
1 parent aef0546 commit b971f41

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/features/exporter/js/exporter.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@
6161
*/
6262
module.constant('uiGridExporterConstants', {
6363
featureName: 'exporter',
64+
rowHeaderColName: 'treeBaseRowHeaderCol',
6465
ALL: 'all',
6566
VISIBLE: 'visible',
6667
SELECTED: 'selected',
6768
CSV_CONTENT: 'CSV_CONTENT',
6869
BUTTON_LABEL: 'BUTTON_LABEL',
69-
FILE_NAME: 'FILE_NAME'
70+
FILE_NAME: 'FILE_NAME',
71+
PIXEL_PER_UNIT: 75
7072
});
7173

7274
/**
@@ -1533,9 +1535,11 @@
15331535
// The standard column width in Microsoft Excel 2000 is 8.43 characters based on fixed-width Courier font
15341536
// Width of 10 in excel is 75 pixels
15351537
var colWidths = [];
1536-
var startDataIndex = grid.treeBase ? grid.treeBase.numberLevels : (grid.enableRowSelection !== false ? 1 : 0);
1538+
var startDataIndex = grid.treeBase ? grid.treeBase.numberLevels : (grid.enableRowSelection ? 1 : 0);
15371539
for (var i = startDataIndex; i < grid.columns.length; i++) {
1538-
colWidths.push({width: (grid.columns[i].drawnWidth / 75) * 10});
1540+
if (grid.columns[i].field !== uiGridExporterConstants.rowHeaderColName) {
1541+
colWidths.push({width: (grid.columns[i].drawnWidth / uiGridExporterConstants.PIXEL_PER_UNIT) * 10});
1542+
}
15391543
}
15401544
sheet.setColumns(colWidths);
15411545

0 commit comments

Comments
 (0)