[英]Export the html table to csv
我在這里有一個樣本小提琴 ,我可以將html表打印為pdf格式,
function printpage() {
var data = '<table border="1" cellspacing="0"><tr><td colspan="4">Sample Report</td></tr>' + document.getElementsByTagName('table')[0].innerHTML + '</table>';
data += '<br/><button onclick="window.print()" class="noprint">Print the Report</button>';
data += '<style type="text/css" media="print"> .noprint {visibility: hidden;} </style>';
myWindow = window.open('', '', 'width=800,height=600');
myWindow.innerWidth = screen.width;
myWindow.innerHeight = screen.height;
myWindow.screenX = 0;
myWindow.screenY = 0;
myWindow.document.write(data);
myWindow.document.close();
myWindow.focus();
}
如何在打印預覽頁面內添加一個按鈕,使用該按鈕可以以csv / xls格式導出同一表格?
通過下面的鏈接。 您將獲得解決方案
`http://jsfiddle.net/terryyounghk/KPEGU/`
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.