rainabba / jquery-table2excel

jQuery Plugin to export HTML tabled to Excel Spreadsheet Compatible Files
593 stars 666 forks source link

Exporting large volume to excel (1200 rows) not creating .xsls file #51

Open tejas6jan opened 8 years ago

tejas6jan commented 8 years ago

Hi, I have tried to export table that contains more than 1000 rows. And found that the file is failed to download saying network error. However, it works totally fine in case of less number of records.

Attached is the image showing the error image

Please help.

Thanks

lanyudhy commented 7 years ago

I have encountered this question few days ago. Did you resolve it ? Please help. Thanks.

sureshputtur commented 7 years ago

Rather than converting the file to base64 convert to blob object . It will work.

Edward-Shaw commented 7 years ago

How to convert to blob object? Would you please public your code? Thanks,

rainabba commented 7 years ago

I want to emphasize again, that this entire approach is a hack. It's using a browser feature that's rarely used.

@sureshpoosapati Can you provide more info or a PR?

@Edward-Shaw The code is public. This issue is in the project. The actual code is at https://github.com/rainabba/jquery-table2excel/blob/master/src/jquery.table2excel.js

sureshputtur commented 7 years ago

var contentType = "application/vnd.ms-excel"; var byteCharacters = e.format(fullTemplate, e.ctx); var byteNumbers = new Array(byteCharacters.length); for (var i = 0; i < byteCharacters.length; i++) { byteNumbers[i] = byteCharacters.charCodeAt(i); } var byteArray = new Uint8Array(byteNumbers); var blob = new Blob([byteArray], {type: contentType}); var blobUrl = URL.createObjectURL(blob); //FILEDOWNLOADFIX END a = document.createElement("a"); a.download = getFileName(e.settings); a.href = blobUrl; document.body.appendChild(a); a.click(); document.body.removeChild(a);

rainabba commented 7 years ago

I'll look at testing/integrating tomorrow. @sureshpoosapati or @tejas6jan If you can link me to a table I can test this against, which has been a problem in the past, that would be helpful.

David3310273 commented 7 years ago

I've tried in firefox and it can download the large excel table, but failed in chrome, is that something wrong?

sureshputtur commented 7 years ago

Are you using latest jquery-table2excel plugin file. In latest there is a fix for large excel sheet. Check it once @David3310273

bolla72892 commented 5 years ago

How can i export the data into excel which is not in the table tag.please provide the solution.

how can i add div tags which are outside of the table tag into full template