Reputation:
I am trying to generate PDF file from HTML table using JSPDF and AutoTable. A html table is given below:
<table id="table" style="display:none;">
<thead>
<tr>
<th>sl</th>
<th>First</th>
<th>Last</th>
<th>Email</th>
<th>Country</th>
</tr>
<tr>
<th>No</th>
<th>name</th>
<th>name</th>
<th>id</th>
<th>name</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>xyz</td>
<td>jkl</td>
<td>abc</td>
<td>pqr</td>
</tr>
</tbody>
</table>
My question: Is there any option to hide the header column named "Sl
" when converting the table data into the PDF file?
Fiddle is here : https://jsfiddle.net/tbz8p79j/7/
Upvotes: 0
Views: 1329
Reputation: 8151
Hiding the first column can be accomplished by simply setting it's width to zero:
doc.autoTable(res.columns, res.data, {
columnStyles: {0: {columnWidth: 0}}
});
You can also play with for example the drawCell hook similar to the colspan and rowspan example in the repo.
Upvotes: 1