Export Empty cells

Export Empty cells

Wooly65Wooly65 Posts: 85Questions: 25Answers: 1

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: 63,457Questions: 1Answers: 10,466 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: 85Questions: 25Answers: 1

    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: 63,457Questions: 1Answers: 10,466 Site admin
    Answer ✓

    Yup - its in my list!

    Allan

  • allanallan Posts: 63,457Questions: 1Answers: 10,466 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

  • sravanitedlasravanitedla Posts: 2Questions: 1Answers: 0

    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

  • allanallan Posts: 63,457Questions: 1Answers: 10,466 Site admin

    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

This discussion has been closed.