简体   繁体   中英

function to export excel

function exportGrid(tableid,filename) {
     var table= document.getElementById(tableid);
     $("table tr td:last-child").replaceWith("");
     var html = table.outerHTML;
     var a = document.createElement('a');
    a.id = 'ExcelDL';
    a.href = 'data:application/vnd.ms-excel,' + escape(html);
    a.download = filename + ".xls";
    document.body.appendChild(a);
    a.click(); 
    // location.reload();
    // document.getElementById('ExcelDL').remove();
    }

i have this function on jSP and i want to export a table with pagination, the trouble is, that function just export de view of the greed

you can use a js library for that

https://tableexport.v3.travismclarke.com/ for example

I hope this may help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM