I have a problem to convert an HTML table to an Excel file. I use
window.open ('data: application / vnd.ms-excel,' + ...
in javascript to perform this conversion. The problem is that the Excel file generated only has a one cell with all the HTML code inside. I need a typical table with rows and columns in Excel.
Thanks in advance and greetings to the community. I am super newbie ... please be patient! ;)
JAVASCRIPT CODE:
function excelSeguimientos() {
window.open('data:application/vnd.ms-excel,' + $('#tablaSeguimientos').html());
e.preventDefault();
}
HTML CODE (TABLE):
<table width="1000" id="tablaSeguimientos">
<tr bgcolor="#CCC">
<td width="100">Fecha</td>
<td width="700">Seguimiento</td>
<td width="170">Producto</td>
<td width="30"> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td><?php
$date = date_create($row_Recordset3['fecha']);
echo date_format($date, 'd-m-Y');
?></td>
<td><?php echo $row_Recordset3['descripcion']; ?></td>
<td><?php echo $row_Recordset3['producto']; ?></td>
<td><img src="borrar.png" width="14" height="14" class="clickable" onClick="eliminarSeguimiento(<?php echo $row_Recordset3['idSeguimiento']; ?>)" title="borrar"></td>
</tr>
</table>
Thanks for all!!
NOTE: Is it possible to remove automatic the column with the image? Because the table is autogenerated by a mysql query, and has many rows! Thanks!