Thank you. The issue has been resolved. We have decided to generate an Excel file on the backend, utilizing data and column headers from a grid. Subsequently, we will transmit this Excel file back to the client’s browser. Here’s an example that might be useful for someone. Just use any library that lets create and convert excel file to blob.
const grid_headers = hotInstance.getColHeader();
const grid_data = hotInstance.getData();
const data = {
'type': 'PO_Detail',
'grid_data': grid_data,
'grid_headers': grid_headers
};
axios.post( url + '/api/v1/excel/export', data,
{
headers:
{
'Authorization': 'Bearer ' + token,
'Content-Type': 'application/json'
},
responseType: 'arraybuffer',
}
).then((response) => {
const url_l = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url_l;
link.setAttribute('download', type + Math.random() + '_.xlsx');
document.body.appendChild(link);
link.click();
}).catch((error) => console.log(error));