how to use mergeCells
how to use mergeCells
nikki111
Posts: 8Questions: 3Answers: 0
can anyone tell me please how to use how to use mergeCells , i see it in discussion's on this forum
https://github.com/DataTables/Buttons/blob/533156edef9d49a6c93b2f04a87312f33b31f9dc/js/buttons.html5.js#L1122
This discussion has been closed.
Answers
mergeCells
is an Open Spreadsheet XML defined property. The function you linked to is an internal function in Buttons' export for Excel and is not exposed externally.Do you need to merge cells in your Excel file? The
customize
callback of theexcelHtml5
button type is the way to modify the XML that is generated. You will need to know the structure of the XML you want to create though.Allan
hmm, @allan yes i am using customize function but do you have any example how i can merge cells like A1 and B1(horizontally ) or A1 and A2(vertically)
i am generating row like this
var Addrow = function (index, data) {
var msg = '<row r="' + index + '">'
for (var i = 0; i < data.length; i++) {
var key = data[i].key;
var value = data[i].value;
msg += '<c t="inlineStr" r="' + key + index + '">';
msg += '<is>';
msg += '<t>' + value + '</t>';
msg += '</is>';
msg += '</c>';
}
msg += '</row>';
return msg;
};
var r1 = Addrow(1, [{ key: 'A', value: 'aaaa' }]);
var sheetValues = sheet.childNodes[0].childNodes[1].innerHTML;
sheet.childNodes[0].childNodes[1].innerHTML = r1 + r2 + r3 + r4 + r5 + r6 + r7 + r8 + r9 + r10 + r11 + r12+ sheetValues
The function that you linked to in GitHub is how Buttons does it itself. I'm afraid I don't have any examples of seeing the mergeCells in the
customize
callback.Allan