Added support of multiple dataset
·
108 commits
to master
since this release
/*When you want to use dataSet directly, you can specify multiple data to single ExcelSheet with following structure,
//i.e You can have multiple dataSets on Multiple Sheets in Single Excel File
interface {
xSteps?: number; //How many cells to skips from left (Optional)
ySteps?: number; //How many rows to skips from last data (Optional)
columns: [array | string] //array (required)
data: [array_of_array | string|boolean|number] //array of arrays (required)
}
*/
import React from "react"
import {default as ExcelFile, ExcelSheet} from "react-data-export"
const multiDataSet = [
{
columns: ["Name", "Salary", "Sex"],
data: [
["Johnson", 30000, "Male"],
["Monika", 355000, "Female"],
["Konstantina", 20000, "Female"],
["John", 250000, "Male"],
["Josef", 450500, "Male"],
]
},
{
xSteps: 1, // Will start putting cell with 1 empty cell on left most
ySteps: 5, //will put space of 5 rows,
columns: ["Name", "Department"],
data: [
["Johnson", "Finance"],
["Monika", "IT"],
["Konstantina", "IT Billing"],
["John", "HR"],
["Josef", "Testing"],
]
}
];
class App extends React.Component {
render() {
return (
<ExcelFile>
<ExcelSheet dataSet={multiDataSet} name="Organization" />
<!-- You can add more ExcelSheets if you need -->
</ExcelFile>
);
}
}