Skip to content

Commit d952266

Browse files
committed
Add new props
1 parent d0ca63d commit d952266

File tree

4 files changed

+29
-18
lines changed

4 files changed

+29
-18
lines changed

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ReactHTMLTableToExcel
2-
Provides a client side generation of Excel (.xls) file from HTML table element. No additional dependencies.
2+
Provides a client side generation of Excel (.xls) file from HTML table element.
3+
4+
___
5+
No additional dependencies, except React.
6+
___
37

48
## Installation
59

@@ -11,10 +15,11 @@ Dependencies: React >= 0.13.0
1115

1216
## Features
1317

14-
* Download HTML table as Excel file;
15-
* No server side code;
16-
* Set desired .xls filename and sheet;
17-
* Supported IE 11;
18+
* Download HTML table as Excel file in .xls format
19+
* No server side code
20+
* Set desired .xls filename and sheet
21+
* Set desired class name and id for styling
22+
* Supported IE 11
1823

1924
## Example
2025

index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,13 @@ var ReactHTMLTableToExcel = function (_Component) {
8282
key: 'render',
8383
value: function render() {
8484
return _react2.default.createElement(
85-
'div',
86-
null,
87-
_react2.default.createElement(
88-
'button',
89-
{ id: 'react-html-table-to-excel', type: 'button', onClick: this.download },
90-
this.props.buttonText || 'Download'
91-
)
85+
'button',
86+
{
87+
id: this.props.id || '',
88+
className: this.props.className || '',
89+
type: 'button',
90+
onClick: this.download },
91+
this.props.buttonText || 'Download'
9292
);
9393
}
9494
}]);
@@ -97,6 +97,8 @@ var ReactHTMLTableToExcel = function (_Component) {
9797
}(_react.Component);
9898

9999
ReactHTMLTableToExcel.propTypes = {
100+
id: _react.PropTypes.string,
101+
className: _react.PropTypes.string,
100102
table: _react.PropTypes.string.isRequired,
101103
filename: _react.PropTypes.string.isRequired,
102104
sheet: _react.PropTypes.string.isRequired,

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"react",
1616
"excel",
1717
"table",
18-
"html"
18+
"html",
19+
"xls"
1920
],
2021
"author": "Zvonimir Susac",
2122
"license": "MIT",
@@ -31,7 +32,6 @@
3132
"react": "^15.5.4"
3233
},
3334
"dependencies": {
34-
"react": "^15.5.4",
35-
"react-dom": "^15.5.4"
35+
"react": "^15.5.4"
3636
}
3737
}

src/ReactHTMLTableToExcel.jsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,18 @@ class ReactHTMLTableToExcel extends Component {
8080

8181
render() {
8282
return (
83-
<div>
84-
<button id="react-html-table-to-excel" type="button" onClick={this.download}>{this.props.buttonText || 'Download'}</button>
85-
</div>
83+
<button
84+
id={this.props.id || ''}
85+
className={this.props.className || ''}
86+
type='button'
87+
onClick={this.download}>{this.props.buttonText || 'Download'}</button>
8688
)
8789
}
8890
}
8991

9092
ReactHTMLTableToExcel.propTypes = {
93+
id: PropTypes.string,
94+
className: PropTypes.string,
9195
table: PropTypes.string.isRequired,
9296
filename: PropTypes.string.isRequired,
9397
sheet: PropTypes.string.isRequired,

0 commit comments

Comments
 (0)