Skip to content

Commit 855d37a

Browse files
697668@gmail.com697668@gmail.com
authored andcommitted
feat: if the header has style then the style should be used
1 parent ae209dd commit 855d37a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

dist/ExcelPlugin/utils/DataUtil.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ var excelSheetFromDataSet = function excelSheetFromDataSet(dataSet) {
7171
fixRange(range, 0, 0, rowCount, xSteps, ySteps);
7272
var colTitle = col;
7373
if ((typeof col === 'undefined' ? 'undefined' : _typeof(col)) === 'object') {
74-
colTitle = col.title;
74+
//colTitle = col.title; //moved to getHeaderCell
7575
columnsWidth.push(col.width || { wpx: 80 }); /* wch (chars), wpx (pixels) - e.g. [{wch:6},{wpx:50}] */
7676
}
7777
getHeaderCell(colTitle, cellRef, ws);
@@ -102,8 +102,8 @@ var excelSheetFromDataSet = function excelSheetFromDataSet(dataSet) {
102102

103103
function getHeaderCell(v, cellRef, ws) {
104104
var cell = {};
105-
var headerCellStyle = { font: { bold: true } };
106-
cell.v = v;
105+
var headerCellStyle = v.style ? v.style : { font: { bold: true } }; //if style is then use it
106+
cell.v = v.title;
107107
cell.t = 's';
108108
cell.s = headerCellStyle;
109109
ws[cellRef] = cell;

src/ExcelPlugin/utils/DataUtil.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const excelSheetFromDataSet = (dataSet) => {
5858
fixRange(range, 0, 0, rowCount, xSteps, ySteps);
5959
var colTitle = col;
6060
if (typeof col === 'object'){
61-
colTitle = col.title;
61+
//colTitle = col.title; //moved to getHeaderCell
6262
columnsWidth.push(col.width || {wpx:80}); /* wch (chars), wpx (pixels) - e.g. [{wch:6},{wpx:50}] */
6363
}
6464
getHeaderCell(colTitle, cellRef, ws);
@@ -89,8 +89,8 @@ const excelSheetFromDataSet = (dataSet) => {
8989

9090
function getHeaderCell(v, cellRef, ws) {
9191
var cell = {};
92-
var headerCellStyle = {font: {bold: true}};
93-
cell.v = v;
92+
var headerCellStyle = v.style ? v.style : { font: { bold: true } }; //if style is then use it
93+
cell.v = v.title;
9494
cell.t = 's';
9595
cell.s = headerCellStyle;
9696
ws[cellRef] = cell;

0 commit comments

Comments
 (0)