Export Empty cells
Export Empty cells
Could you allow a customize option to export empty cells? The reason is if empty cells are not exported a style can not be applied because there is no cell definition. I would like to put a thin border around column B, but because cell B177 isn't defined the style will not be applied to B177 and when you look at the excel spreadsheet it looks ugly.
The current code (buttons.html5.js line 1040) skips over any null, undefined or blank cells.
// For null, undefined of blank cell, continue so it doesn't create the _createNode
if ( row[i] === null || row[i] === undefined || row[i] === '' ) {
continue;
}
An update could look like
// For null, undefined of blank cell, continue so it doesn't create the _createNode
if (row[i] === null || row[i] === undefined || row[i] === '') {
if (config.exportEmptyCells) {
cell = _createNode(rels, 'c', {
attr: {
r: cellId
}
});
rowNode.appendChild(cell);
}
continue;
}
This question has an accepted answers - jump to answer
Answers
Yes. I think an
emptyCells
option for theexcelHtml5
andexcelFlash
buttons which simply takes a boolean value sounds like require a good option. Thanks for the suggestion!Allan
I noticed you touched the buttons.html5.js and buttons.flash.js recently. Could you think about adding in the feature before the next release.
Yup - its in my list!
Allan
I've added a
createEmptyCell
option into the Excel export buttons now, which will be included in the 1.5.0 release of Buttons tomorrow.Allan
Hi Allan,
Thanks for the createEmptyCell option , I have tried it but it ouputs true in the empty button, How to fix that?
Could you please guide?
Thanks,
Sravani
Sorry about that! Fixed here. I'm going to do a 1.5.1 release before the end of the week which will contain this fix.
Allan