using below code we get access to blob.sheets
var blob = this.exportData({
format: 'xlsx',
nopqdata: true,
render: true,
workbook: true
});
Full export code for reference
listener: function () {
var format = 'xlsx';
var blob = this.exportData({
format: format,
nopqdata: true,
render: true,
workbook: true
});
var fileName = 'download';
//-------- Header Row Print in excel
if (format == 'xlsx') {
if (config.exportTitle == true && config.titleData.length > 0) {
var titleCount = config.titleData.length;
$(config.titleData).each(function (tIndex, title) {
blob.sheets[0].rows.insert(tIndex, title);
});
blob.sheets[0].frozenRows += titleCount; // Increase frozen rows
blob.sheets[0].headerRows += titleCount; // Increase header rows
// As we have added header shift merging cells with the number of header lines
if (blob.sheets[0]['mergeCells'] && blob.sheets[0].mergeCells.length > 0) {
$(blob.sheets[0].mergeCells).each(function (i, v) {
var m = v.split(":");
var d1 = m[0].replace(/\D+/g, ''); // get digit;
var a1 = m[0].replace(/\d+/g, ''); // get alphabet;
d1 = parseInt(d1) + titleCount;
var d2 = m[0].replace(/\D+/g, ''); // get digit;
var a2 = m[0].replace(/\d+/g, ''); // get alphabet;
d2 = parseInt(d2) + titleCount;
blob.sheets[0].mergeCells = [a1 + d1 + ":" + a2 + d2];
});
}
}
//-------------------------
//----------- Remove HTML tags and keep text.
pq.excel.eachCell(blob.sheets, function (cell) {
var val = cell.value;
if (typeof val == "string" && val.indexOf("<") != -1) {
if (val.indexOf("<input") != -1) {
if ($(val)) {
val += ' ' + $(val).val();
}
}
var $p = $("<p>").html(val);
cell.value = $p.text();
}
if (typeof val == "string") {
cell.value = " " + cell.value;
}
if (cell.hasOwnProperty("format") && !!cell.format && dateFormats.indexOf(cell.format.toLowerCase()) >= 0) {
cell.value = formatDateTime(val);
}
});
blob = pq.excel.exportWb({ workbook: blob });
}
saveAs(blob, fileName + "." + format);
}
* Note : Above code was working properly in v9.0.1