jquery-table2excel
jquery-table2excel copied to clipboard
How to give different css styles to excel than html table using table2excel
Can anyone suggest How to give different css styles to exported excel file than html table using table2excel.js file
I have the same issue. I tried t use inline css but not working.
@marie15 , @vasubalaga
Change 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>";
}
}
});