Currently, I'm working on creating a Datatable Excel file that can support multiple footers along with an export option.
However, I've run into an issue where the footer is only being generated in a single cell without support for multiple lines.
I'd like to know if it's possible to create multiline footers in the exported excel file. If so, how would I go about implementing this using javascript?
Alternatively, is there another workaround that could achieve the desired result?
Below is a snippet of code showcasing how I have set up the datatable in JavaScript and added a tfoot element to the table:
'<tfoot id="reportTblFoot' + chartIndex+ '">'+
'</tfoot>'
Here is a variable representing the table footer:
var footer1 = $("<tr />");
The data is then appended to the footer as follows:
footer1.append(
"<th>" +
"<div style='font-style:italic;font-size:10px'>" +
"* Applicable row 1<br>\n" +
"** Not Applicable row 2<br>\n" +
"*** Not Applicable row 3\n" +
"</div>" +
"<div>" +
"<font size='1' color='grey'>**** Not Applicable row 4</font>" +
"</div>" +
"</th>"
);
footer1.append("<th style='display:none'/>");
footer1.append("<th style='display:none'/>");
$(tfoot).append(footer1);
To enable the footer in the datatable properties, ensure that 'TRUE' is applied:
buttons: [
{
extend: 'excel',
footer :true,
filename : fileName,
title : rprtTtl,
orientation: "landscape",
pageSize : "A3",
}]