我创建了一个随机表,并且我一直试图将其导出为excel,csv,pdf,并且能够复制和打印表格。除了导出到excel之外,我能做所有事情,而且我不确定我忘记添加的文件是什么。这是我的代码:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.dataTables.js" type="text/javascript"></script>
<script src="dataTables.buttons.js" type="text/javascript"></script>
<script src="buttons.flash.min.js" type="text/javascript"></script>
<script src="buttons.html5.min.js" type="text/javascript"></script>
<script src="buttons.print.min.js" type="text/javascript"></script>
<script src="flashExport.swf" type="text/javascript"></script>
<script src="dataTables.buttons.js" type="text/javascript"></script>
<script type="text/javascript" src="https://cdn.datatables.net/tabletools/2.2.2/swf/copy_csv_xls_pdf.swf"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js"></script>
</head>
<body>
<table id="demoTable">
<thead>
<tr>
<th> Name</th>
<th> Program</th>
<th> Age</th>
<th> Homecity</th>
</tr>
</thead>
<tbody>
<tr>
<td> A</td>
<td> Computer Engineering</td>
<td> 20 Years old</td>
<td> Mississauga</td>
</tr>
<tr>
<td> B</td>
<td> Computer Engineering</td>
<td> 19 Years old</td>
<td> Vancouver</td>
</tr>
<tr>
<td> C</td>
<td> Computer Engineering</td>
<td> 19 Years old</td>
<td> Vancouver</td>
</tr>
<tr>
<td> D</td>
<td> Computer Engineering</td>
<td> 19 years old</td>
<td> Ottawa</td>
</tr>
</tbody>
</table>
</body>
<script type="text/javascript">
$(function() {
$("#demoTable").DataTable({
dom: 'Bfrtip',
buttons: ['csv', 'excel', 'pdf', 'copy', 'print']
});
})
</script>
&#13;
提前感谢您帮助我。