JSFiddle - React, Tailwind, and code Playground
by tjmcdevitt
HTML
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdn.datatables.net/1.10.13/js/jquery.dataTables.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.13/css/jquery.dataTables.min.css">
<script src="https://cdn.datatables.net/buttons/1.2.4/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.2.4/js/dataTables.buttons.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.2.4/css/buttons.dataTables.min.css">
<script src="https://cdn.jsdelivr.net/gh/bpampuch/pdfmake@0.1.24/build/vfs_fonts.js"></script>
<script src="https://cdn.jsdelivr.net/gh/bpampuch/pdfmake@0.1.24/build/pdfmake.min.js"></script>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
<th>Position</th>
<th>Office</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger</td>
<td>Nixon</td>
<td>System Architect<sup>5</sup></td>
<td>Edinburgh</td>
<td>$320,800</td>
</tr>
</tbody>
</table>
JavaScript
$(document).ready(function() {
$('#example').DataTable({
dom: 'Bfrtip',
columns: [{
data: 'name'
},
{
data: 'surname'
},
{
data: 'position'
},
{
data: 'office'
},
{
data: 'salary'
}
],
buttons: [{
extend: 'excelHtml5',
exportOptions: {
orthogonal: 'export'
},
customize: function(xlsx) {
var sheet = xlsx.xl['styles.xml'];
var tagName = sheet.getElementsByTagName('sz');
for (i = 0; i < tagName.length; i++) {
tagName[i].setAttribute("superscript", "55")
}
console.log(tagName)
}
}]
});
});