I am trying to get a table generated in html with the aforementioned property, for the generation of an .xls file If I pass the direct value, my .xls is perfectly accommodated as I require it:
vmHome.table = "<table><tr><th>Saldo en Coppel</th><th>Cuentas activas coppel</th><th>Saldo por cuenta</th></tr><tr> <td rowspan='3'>$17,000.00</td><td>Ropa</td><td>$10,000.00</td></tr><tr> <td>Muebles</td><td>$2,000.00</td></tr><tr> <td>Prestamos</td><td>$5,000.00</td></tr><tr> <td rowspan='2'>$23,000.00</td><td>Ropa</td><td>$15,000.00</td></tr><tr> <td>Muebles</td><td>$8,000.00</td></tr></table>"
The error happens when you get the table with the following line of code:
HTML:
<button type="button" class="btn btn-default" ng-click="vmHome.generateExcel()">Export</button>
<table id="tablaDatos">
<tr>
<th>Saldo en Coppel</th>
<th>Cuentas activas coppel</th>
<th>Saldo por cuenta</th>
</tr>
<tr>
<td rowspan='3'>$17,000.00</td>
<td>Ropa</td>
<td>$10,000.00</td>
</tr>
<tr>
<td>Muebles</td>
<td>$2,000.00</td>
</tr>
<tr>
<td>Prestamos</td>
<td>$5,000.00</td>
</tr>
<tr>
<td rowspan='2'>$23,000.00</td>
<td>Ropa</td>
<td>$15,000.00</td>
</tr>
<tr>
<td>Muebles</td>
<td>$8,000.00</td>
</tr></table>
CONTROLLER:
vmHome.generateExcel = function() {
var tablahtml = document.getElementById('tablaDatos').innerHTML;
vmHome.downloadCSV(tablahtml,'reporte.xls');
}
And it's what I need for export, my .xls is not generated correctly.