react-data-export
react-data-export copied to clipboard
Multiple excel download using single button click
I have read your documentation. I am trying to download multiple excel files in single element click. Is this possible in this library?. Also having requirement to zip all these files. Please let me know the details. These details not mentioning in your documentation.
I Can download multiple excel files by using UseRef and trigger click manually. below FYR
<Tooltip title="Daily log,Morning shift & Evening shift templates download" placement="bottom"><Button onClick={() => formTemplateDownload()} style={{ backgroundColor: '#04588e', color: 'white', paddingTop: '2px', paddingBottom: '2px', paddingLeft: '20px', paddingRight: '20px' }}>Download Templates</Button></Tooltip>
<ExcelFile filename={`${loggedInVesselName}_DailyLogTemplate`} element={<Tooltip title="Export Daily Log Template" placement="bottom"><Button ref={dailyLogRef} style={{ backgroundColor: '#04588e', color: 'white', paddingTop: '2px', paddingBottom: '2px', paddingLeft: '20px', paddingRight: '20px',display: "none" }}>Daily Log</Button></Tooltip>}>
<ExcelSheet dataSet={generatedData} name="Daily Log" />
</ExcelFile>
<ExcelFile filename={`${loggedInVesselName}_MorningShiftTemplate`} element={<Tooltip title="Export Morning Shift Template" placement="bottom"><Button ref={morningShiftRef} style={{ backgroundColor: '#04588e', color: 'white', paddingTop: '2px', paddingBottom: '2px', paddingLeft: '20px', paddingRight: '20px',display: "none" }}>Morning Shift</Button></Tooltip>}>
<ExcelSheet dataSet={morningShiftLogGeneratedData} name="Morning Shift Log" />
</ExcelFile>
<ExcelFile filename={`${loggedInVesselName}_EveningShiftTemplate`} element={<Tooltip title="Export Evening Shift Template" placement="bottom"><Button ref={eveningShiftRef} style={{ backgroundColor: '#04588e', color: 'white', paddingTop: '2px', paddingBottom: '2px', paddingLeft: '20px', paddingRight: '20px',display: "none" }}>Evening Shift</Button></Tooltip>}>
<ExcelSheet dataSet={eveningShiftLogGeneratedData} name="Evening Shift Log" />
</ExcelFile>
const formTemplateDownload = () => {
dailyLogRef.current.click();
morningShiftRef.current.click();
eveningShiftRef.current.click();
}
Now I need to zip these files. Thanks and revert