Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExcelJS - changing 'wrapText' setting according grid.wordWrapEnabled option #11701

Merged
merged 3 commits into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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