JS:下载到excel表格中的行

我有一个下载作为excelbutton,它会下载一个表为用户,但我想添加一个方式,他们可以打勾选框并下载勾选的行。 我有勾选框添加一个类的下载到TR我怎样才能编辑JS我只需要下载类的下载TR?

我的JS为我的下载:

$(document).on('click', '.download', function (event) { fnExcelReport() }); function fnExcelReport() { var tab_text="<table border='2px'><tr>"; var textRange; var j=0; tab = document.getElementById('main-table'); for(j = 0 ; j < tab.rows.length ; j++) { tab_text=tab_text+tab.rows[j].innerHTML+"</tr>"; } tab_text=tab_text+"</table>"; 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.document.open("txt/html","replace"); txtArea1.document.write(tab_text); txtArea1.document.close(); txtArea1.focus(); sa=txtArea1.document.execCommand("SaveAs",true,"Say Thanks to Sumit.xls"); } else sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text)); return (sa); }