Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/ReactHTMLTableToExcel.jsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
const propTypes = {
table: PropTypes.string.isRequired,
filename: PropTypes.string.isRequired,
filetype: PropTypes.string,
sheet: PropTypes.string.isRequired,
id: PropTypes.string,
className: PropTypes.string,
Expand DownExpand Up@@ -50,7 +51,9 @@ class ReactHTMLTableToExcel extends Component {

const table = document.getElementById(this.props.table).outerHTML;
const sheet = String(this.props.sheet);
const filename = `${String(this.props.filename)}.xlsx`;
const filetype = String((this.props.filetype)?(this.props.filetype === 'xlsx'?'xlsx':'xls'):'xls')
const filename = `${String(this.props.filename) + '.' + filetype}`;


const uri = 'data:application/vnd.ms-excel;base64,';
const template =
Expand Down