I am trying to export more than 15,000 lines to excel in html (they are within table
), however it is not exporting, it only opens a blank browser tab. When I put fewer rows, it exports normally.
Follow the javascript:
function fnExcelReport(tabela)
{
var tab_text="<table border='2px'><tr bgcolor='#87AFC6'>";
var textRange; var j=0;
tab = document.getElementById(tabela); // id of table
for(j = 0 ; j < tab.rows.length ; j++)
{
tab_text=tab_text+tab.rows[j].innerHTML+"</tr>";
//tab_text=tab_text+"</tr>";
}
tab_text=tab_text+"</table>";
tab_text= tab_text.replace(/<A[^>]*>|<\/A>/g, "");
tab_text= tab_text.replace(/<img[^>]*>/gi,"");
tab_text= tab_text.replace(/<input[^>]*>|<\/input>/gi, "");
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))
{
txtArea1.contentDocument.open("txt/html","replace");
txtArea1.contentDocument.write(tab_text);
txtArea1.contentDocument.close();
txtArea1.focus();
sa=txtArea1.contentDocument.execCommand("SaveAs",true,"arquivo.xls");
}
else
sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));
return (sa);}