Most common questions and answers


  1. What is the best way to create odd/even rows on a jexcel spreadsheet and tables?

  2. Solution: Adding the following CSS code on your project.

    .jexcel tbody tr:nth-child(even) {
      background-color: #EEE9F1 !important;
    }
    

  3. How to transform multiple HTML static tables in dynamic jexcel tables?

  4. var tables = document.querySelectorAll('table');
    for (var i = 0; i < tables.length; i++) {
        jexcel(tables[i]);
    }
    

  5. How to disable paste over a jexcel spreadsheet?

  6. jexcel(document.getElementById('spreadsheet'), {
        onbeforepaste: function(instance, data, x, y) {
            return false;
        }
    });
    

  7. How to intercept and change a pasted string over a jexcel table?

  8. jexcel(document.getElementById('spreadsheet'), {
        onbeforepaste: function(instance, data, x, y) {
            data = data.replace(',', '.', data);
            return data;
        }
    });
    

  9. How to overwrite a type of a cell over a column type?

  10. jexcel(document.getElementById('spreadsheet'), {
        columns: [
            { type: 'text' },
            { type: 'text' }, 
        ],
        cells: {
            B2: { type:'number', mask:'$ #,##.00', decimal:'.' },
            B3: { type:'percent' },
        }
    });
    
    NOTE: Only available from jExcel Pro v7.

  11. How to disabled the javascript contextmenu of my spreadsheet?

  12. jexcel(document.getElementById('spreadsheet'), {
        columns: [
            { type: 'text' },
            { type: 'text' }, 
        ],
        contextMenu: function() {
            return false;
        }
    });
    


  13. How to change the default download filename?

  14. jexcel(document.getElementById('spreadsheet'), {
        csvFileName: 'yourname'
    });
    


  15. How to add an external action without losing the spreadsheet focus?

  16. Working example:

    https://jsfiddle.net/paulhodel/v5tbxg01/


  17. How to keep the selection of the spreadsheet clicking in a element outside.

  18. Add a class to the external element: jexcel_object