tableexport
Version:
The simple, easy-to-implement library to export HTML tables to xlsx, xls, csv, and txt files
143 lines (129 loc) • 4.39 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Headers / Footers</title>
<link href="../dist/css/tableexport.min.css" rel="stylesheet">
<link href="./examples.css" rel="stylesheet">
</head>
<body>
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-TL44T9" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<a id="example-link" href="./"> << Examples</a>
<iframe src="./defaults.html" frameborder="0" width="100%" scrolling="no" onload="this.height=screen.height/2.5;"></iframe>
<main>
<h1>Headers
<code class="small">headers: false</code>
</h1>
<table id="headers-table">
<thead class="target">
<tr>
<th>Name</th>
<th>Position</th>
<th>Age</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td>Thor Walton</td>
<td>Regional Director</td>
<td>45</td>
<td>$98,540</td>
</tr>
<tr>
<td>Travis Clarke</td>
<td>Software Engineer</td>
<td>30</td>
<td>$275,000</td>
</tr>
<tr>
<td>Suki Burks</td>
<td>Office Manager</td>
<td>22</td>
<td>$67,670</td>
</tr>
</tbody>
<tfoot>
<tr>
<td class="disabled"></td>
<td class="disabled"></td>
<td class="disabled"></td>
<th>$441,210</th>
</tr>
</tfoot>
</table>
<p class="info">export the table to <code>.xlsx</code> and look at the contents of the <span class="target">yellow</span> row. Compared to the export from the <b>defaults</b> table above, you will notice that <code>headers: false</code> <i>removes the <code>thead</code> elements from the file</i>.</p>
</main>
<br>
<main>
<h1>Footers
<code class="small">footers: false</code>
</h1>
<table id="footers-table">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Age</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td>Thor Walton</td>
<td>Regional Director</td>
<td>45</td>
<td>$98,540</td>
</tr>
<tr>
<td>Travis Clarke</td>
<td>Software Engineer</td>
<td>30</td>
<td>$275,000</td>
</tr>
<tr>
<td>Suki Burks</td>
<td>Office Manager</td>
<td>22</td>
<td>$67,670</td>
</tr>
</tbody>
<tfoot>
<tr class="target">
<td class="disabled"></td>
<td class="disabled"></td>
<td class="disabled"></td>
<th>$441,210</th>
</tr>
</tfoot>
</table>
<p class="info">export the table to <code>.xlsx</code> and look at the contents of the <span class="target">yellow</span> row. Compared to the export from the <b>defaults</b> table above, you will notice that <code>footers: false</code> <i>removes the <code>tfoot</code> elements from the file</i>.</p>
</main>
<script type="text/javascript" src="../bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="../bower_components/js-xlsx/dist/xlsx.core.min.js"></script>
<script type="text/javascript" src="../bower_components/blobjs/Blob.min.js"></script>
<script type="text/javascript" src="../bower_components/file-saverjs/FileSaver.min.js"></script>
<script type="text/javascript" src="../dist/js/tableexport.min.js"></script>
<script type="text/javascript" src="../assets/js/analytics.js"></script>
<script>
var HeaderTable = document.getElementById('headers-table');
new TableExport(HeaderTable, {
headers: false
});
// **** jQuery **************************
// $(HeaderTable).tableExport({
// headers: false
// });
// **************************************
var FooterTable = document.getElementById('footers-table');
new TableExport(FooterTable, {
footers: false
});
// **** jQuery **************************
// $(FooterTable).tableExport({
// footers: false
// });
// **************************************
</script>
</body>
</html>