Hi bot how can I add empty row after the row 2 and before the header and data in excel export.
here is my code customize: function () in datatable
var sheet = xlsx.xl.worksheets['sheet1.xml'];
var downrows = 2;
var clRow = $('row', sheet);
clRow.each(function () {
var attr = $(this).attr('r');
var ind = parseInt(attr);
ind = ind + downrows;
$(this).attr("r",ind);
});
$('row c ', sheet).each(function () {
var attr = $(this).attr('r');
var pre = attr.substring(0, 1);
var ind = parseInt(attr.substring(1, attr.length));
ind = ind + downrows;
$(this).attr("r", pre + ind);
});
function row(index,data) {
msg='<row r="'+index+'">'
for(i=0;i<data.length;i++){
var key=data.k;
var value=data.v;
msg += '<c t="inlineStr" r="' + key + index + '" s="">';
msg += '<is>';
msg += '<t>'+value+'</t>';
msg+= '</is>';
msg+='</c>';
}
msg += '</row>';
return msg;
}
var r1 = row(1, [{ k: 'A', v: 'Total Transaction: ' }, { k: 'B', v: totaltransactions }]);
var r2 = row(2, [{ k: 'A', v: 'Total Amount: ' }, { k: 'B', v: totalamount }]);
sheet.childNodes[0].childNodes[1].innerHTML = r1 + r2 + sheet.childNodes[0].childNodes[1].innerHTML;
here is my code customize: function () in datatable
var sheet = xlsx.xl.worksheets['sheet1.xml'];
var downrows = 2;
var clRow = $('row', sheet);
clRow.each(function () {
var attr = $(this).attr('r');
var ind = parseInt(attr);
ind = ind + downrows;
$(this).attr("r",ind);
});
$('row c ', sheet).each(function () {
var attr = $(this).attr('r');
var pre = attr.substring(0, 1);
var ind = parseInt(attr.substring(1, attr.length));
ind = ind + downrows;
$(this).attr("r", pre + ind);
});
function row(index,data) {
msg='<row r="'+index+'">'
for(i=0;i<data.length;i++){
var key=data.k;
var value=data.v;
msg += '<c t="inlineStr" r="' + key + index + '" s="">';
msg += '<is>';
msg += '<t>'+value+'</t>';
msg+= '</is>';
msg+='</c>';
}
msg += '</row>';
return msg;
}
var r1 = row(1, [{ k: 'A', v: 'Total Transaction: ' }, { k: 'B', v: totaltransactions }]);
var r2 = row(2, [{ k: 'A', v: 'Total Amount: ' }, { k: 'B', v: totalamount }]);
sheet.childNodes[0].childNodes[1].innerHTML = r1 + r2 + sheet.childNodes[0].childNodes[1].innerHTML;