Skip to content

Commit

Permalink
ExcelJS - changing 'wrapText' setting according grid.wordWrapEnabled …
Browse files Browse the repository at this point in the history
…option (DevExpress#11701)
  • Loading branch information
EugeniyKiyashko committed Jan 27, 2020
1 parent 6d46755 commit 575ad89
Show file tree
Hide file tree
Showing 2 changed files with 226 additions and 332 deletions.
8 changes: 5 additions & 3 deletions js/exporter/exceljs/exportDataGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ function exportDataGrid(options) {
}
component.option('loadPanel', loadPanel);

const wrapText = !!component.option('wordWrapEnabled');

worksheet.properties.outlineProperties = {
summaryBelow: false,
summaryRight: false
Expand Down Expand Up @@ -58,7 +60,7 @@ function exportDataGrid(options) {
for(let rowIndex = 0; rowIndex < dataRowsCount; rowIndex++) {
const row = worksheet.getRow(cellsRange.from.row + rowIndex);

_exportRow(rowIndex, columns.length, row, cellsRange.from.column, dataProvider, customizeCell, headerRowCount, mergedCells, mergeRanges);
_exportRow(rowIndex, columns.length, row, cellsRange.from.column, dataProvider, customizeCell, headerRowCount, mergedCells, mergeRanges, wrapText);

if(rowIndex >= headerRowCount) {
row.outlineLevel = dataProvider.getGroupLevel(rowIndex);
Expand Down Expand Up @@ -123,7 +125,7 @@ function _getFullOptions(options) {
return fullOptions;
}

function _exportRow(rowIndex, cellCount, row, startColumnIndex, dataProvider, customizeCell, headerRowCount, mergedCells, mergeRanges) {
function _exportRow(rowIndex, cellCount, row, startColumnIndex, dataProvider, customizeCell, headerRowCount, mergedCells, mergeRanges, wrapText) {
const styles = dataProvider.getStyles();

for(let cellIndex = 0; cellIndex < cellCount; cellIndex++) {
Expand All @@ -134,7 +136,7 @@ function _exportRow(rowIndex, cellCount, row, startColumnIndex, dataProvider, cu
excelCell.value = cellData.value;

if(isDefined(excelCell.value)) {
const { bold, alignment, wrapText, format, dataType } = styles[dataProvider.getStyleId(rowIndex, cellIndex)];
const { bold, alignment, format, dataType } = styles[dataProvider.getStyleId(rowIndex, cellIndex)];

let numberFormat = _tryConvertToExcelNumberFormat(format, dataType);
if(isDefined(numberFormat)) {
Expand Down
Loading

0 comments on commit 575ad89

Please sign in to comment.