// 打印表格数据
public printTable(){
let tableToPrint = document.getElementById('tab');//将要被打印的表格
let newWin= window.open("");//新打开一个空窗口
newWin.document.write(tableToPrint.outerHTML);//将表格添加进新的窗口
newWin.document.close();//在IE浏览器中使用必须添加这一句
newWin.focus();//在IE浏览器中使用必须添加这一句
newWin.print();//打印
newWin.close();//关闭窗口
}
// 导出表格
public exportTableList(){
let doc="";
doc+="<table>";
let html=document.getElementById("tab").innerHTML;
doc+=html;
doc+="</table>";
let docFile="<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:"+doc+"' xmlns='http://www.w3.org/TR/REC-html40'>";
docFile=docFile+"<head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head>"+doc+"</body></html>";
let base64data="base64,"+window.btoa(unescape(encodeURIComponent(docFile)));
window.open('data:application/vnd.ms-excel;'+ base64data);
}
// 打印表格数据 public printTable(){ let tableToPrint = document.getElementById('tab');//将要被打印的表格 let newWin= window.open("");//新打开一个空窗口 newWin.document.write(tableToPrint.outerHTML);//将表格添加进新的窗口 newWin.document.close();//在IE浏