rainabba / jquery-table2excel

jQuery Plugin to export HTML tabled to Excel Spreadsheet Compatible Files
592 stars 665 forks source link

Css doesn't work #109

Closed MuhammedAlmaz closed 5 years ago

MuhammedAlmaz commented 5 years ago

The row or column color doesn't change. Is there any mistake about that ? I want to set a backgroud color on the excel but i didn't find anything. The Html code ;

Company Contact Country
Company Contact Country

Jquery Code

$("#tableData").table2excel({ exclude: ".qwe", name: "Deneme", filename: "Deneme" });

MuhammedAlmaz commented 5 years ago

Its solved . I changed this code block

$(p).find("td,th").not(e.settings.exclude).each(function (i,q) { // p did not exist, I corrected

                            var rc = {
                                rows: $(this).attr("rowspan"),
                                cols: $(this).attr("colspan"),
                                style: $(this).attr("style"),
                                flag: $(q).find(e.settings.exclude)
                            };

                            if( rc.flag.length > 0 ) {
                                tempRows += "<td> </td>"; // exclude it!!
                            } else {
                                if( rc.rows  & rc.cols ) {
                                    if(rc.style)
                                    {
                                        tempRows += "<td style='"+rc.style+"' >"  + $(q).html() + "</td>";
                                    }else{
                                        tempRows += "<td>"  + $(q).html() + "</td>";
                                    }

                                } else {
                                    tempRows += "<td";
                                    if( rc.style) {
                                        tempRows +=  " style='"+rc.style+"' ";
                                    }
                                    if( rc.rows > 0) {
                                        tempRows += " rowspan=\'" + rc.rows + "\' ";
                                    }
                                    if( rc.cols > 0) {
                                        tempRows += " colspan=\'" + rc.cols + "\' ";
                                    }
                                    tempRows += "/>" + $(q).html() + "</td>";
                                }
                            }
                        });