Skip to content

Commit bc70bc7

Browse files
Merge branch 'master' into master
2 parents 5f0d69d + f2fe103 commit bc70bc7

File tree

6 files changed

+72
-36
lines changed

6 files changed

+72
-36
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
<a name="0.6.0"></a>
6+
# [0.6.0](https://github.com/securedeveloper/react-data-export/compare/v0.5.0...v0.6.0) (2020-01-20)
7+
8+
9+
### Features
10+
11+
* if the header has style then the style should be used ([855d37a](https://github.com/securedeveloper/react-data-export/commit/855d37a))
12+
13+
14+
515
<a name="0.5.0"></a>
616
# [0.5.0](https://github.com/securedeveloper/react-data-export/compare/v0.4.2...v0.5.0) (2018-09-24)
717

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;

examples/styled_excel_sheet.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,8 @@ class App extends Component {
6262
```
6363

6464
## Output
65-
![Download Button](http://i64.tinypic.com/2mey8na.jpg)
66-
![Excel File Outpu](http://i63.tinypic.com/2qko404.jpg)
65+
![Download Button](https://blvenglu.sirv.com/github/download_styled_excel_sheet.png)
66+
![Excel File Outpu](https://blvenglu.sirv.com/github/styled_excel_sheet.png)
67+
[Codesandbox](https://codesandbox.io/s/styledexcelsheet-hf5oo "Codesandbox | styled_excel_sheet")
68+
69+

package-lock.json

Lines changed: 50 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-data-export",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"main": "dist/index.js",
55
"types": "types/index.d.ts",
66
"description": "A set of tools to export dataset from react to different formats.",

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)