Skip to content

Commit

Permalink
feat(datutil): fixed the merge title issue
Browse files Browse the repository at this point in the history
  • Loading branch information
susanta96 committed Jun 14, 2023
1 parent 0499d76 commit e70237d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
/src/
.github
/src-js
/examples
node_modules

18 changes: 10 additions & 8 deletions dist/ExcelPlugin/utils/DataUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,16 @@ var excelSheetFromDataSet = function excelSheetFromDataSet(dataSet, bigHeading)
}
};
ws['!merges'] = [mergedRange];
var mergeRef = xlsx_js_style_1.utils.encode_range({
c: xSteps,
r: 0
}, {
c: xSteps + dataSetItem.columns.length - 1,
r: 0
});
getHeaderCell(bigHeading, mergeRef, ws);
var cell = {
t: 's',
v: bigHeading.title,
s: bigHeading.style ? bigHeading.style : {
font: {
bold: true
}
}
};
ws['A1'] = cell;
rowCount += 1;
}
var columnsInfo = [];
Expand Down
8 changes: 6 additions & 2 deletions src-js/ExcelPlugin/utils/DataUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,12 @@ const excelSheetFromDataSet = (dataSet, bigHeading) => {
if (bigHeading?.title) {
let mergedRange = { s: { c: xSteps, r: 0 }, e: { c: dataSetItem.columns.length - 1, r: 0 } };
ws['!merges'] = [mergedRange];
let mergeRef = xlsx_js_style_1.utils.encode_range({ c: xSteps, r: 0 }, { c: xSteps + dataSetItem.columns.length - 1, r: 0 });
getHeaderCell(bigHeading, mergeRef, ws);
let cell = {
t: 's',
v: bigHeading.title,
s: bigHeading.style ? bigHeading.style : { font: { bold: true } },
};
ws['A1'] = cell;
rowCount += 1;
}
let columnsInfo = [];
Expand Down
8 changes: 6 additions & 2 deletions src/ExcelPlugin/utils/DataUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ const excelSheetFromDataSet = (dataSet: ExcelSheetData[], bigHeading?: ExcelShee
if(bigHeading?.title) {
let mergedRange: Range = { s: { c: xSteps, r: 0 }, e: { c: dataSetItem.columns.length - 1, r: 0 } };
ws['!merges'] = [mergedRange];
let mergeRef = utils.encode_range({ c: xSteps, r: 0 }, { c: xSteps + dataSetItem.columns.length - 1, r: 0 });
getHeaderCell(bigHeading, mergeRef, ws);
let cell: CellObject = {
t: 's',
v: bigHeading.title,
s: bigHeading.style ? bigHeading.style : { font: { bold: true } },
};
ws['A1'] = cell;
rowCount += 1;
}

Expand Down

0 comments on commit e70237d

Please sign in to comment.