Export Empty cells

Export Empty cells

Wooly65Wooly65 Posts: 17Questions: 6Answers: 0

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

  • allanallan Posts: 43,525Questions: 1Answers: 5,695 Site admin

    Yes. I think an emptyCells option for the excelHtml5 and excelFlash buttons which simply takes a boolean value sounds like require a good option. Thanks for the suggestion!

    Allan

  • Wooly65Wooly65 Posts: 17Questions: 6Answers: 0

    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.

  • allanallan Posts: 43,525Questions: 1Answers: 5,695 Site admin
    Answer ✓

    Yup - its in my list!

    Allan

  • allanallan Posts: 43,525Questions: 1Answers: 5,695 Site admin

    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

Sign In or Register to comment.