rainabba / jquery-table2excel

jQuery Plugin to export HTML tabled to Excel Spreadsheet Compatible Files
593 stars 666 forks source link

New version of plugin is not keeping the table format #84

Open ivorcosta opened 6 years ago

ivorcosta commented 6 years ago

The file downloaded doesn't keep the original table format anymore (bold, cell border, cell colors..) Changing this piece of the code fixes the problem (but may add other problems):

FROM

            $(o).find("tr").not(e.settings.exclude).each(function (i,p) {
                tempRows += "<tr>";
                $(p).find("td,th").not(e.settings.exclude).each(function (i,q) { // p did not exist, I corrected
                    var flag = $(q).find(e.settings.exclude); // does this <td> have something with an exclude class
                    if(flag.length >= 1) {
                        tempRows += "<td> </td>"; // exclude it!!
                    } else {
                        tempRows += "<td>" + $(q).html() + "</td>";
                    }
                });

TO

            $(o).find("tr").not(e.settings.exclude).each(function (i,o) {
                tempRows += "<tr>" + $(o).html() + "</tr>";
            });
atalayxx commented 6 years ago

Okey! Search; console.log(tempRows);

Add before tempRows = $(o).html();

border and other style items are working!

Enjoy