Users can easily and efficiently work with numbers and percentage in Spreadsheets. SpreadJS provides support to automatically append the percentage '%' symbol at the end of the input (digits 09) for the cells that have the percentage format applied to them.
SpreadJS applies different functionalities for different inputs while appending percentage symbol as elaborated below:
Case 1: Entering a number
If you enter a number in a percentageformatted cell, then SpreadJS adds the % symbol to it. For example, the entering a value 6 in the cell formats it to 6.00%.
Case 2: Entering a character
If you enter a character, symbol or letter in the percentageformatted cell, SpreadJS does not append the % symbol to it.
Case 3: Adding a character after a digit
If you add a letter (such as 'h') after a number (such as '6') in the percentageformatted cell, then SpreadJS will still append the percentage symbol (formatted as 6h%).
Case 4: Deleting percentage symbol in celledit mode
If you enter a number in the celledit mode and remove the % symbol from the number and exit the cell, then the number is again converted to the percentage format.
Case 5: Inserting number with % symbol in nonformatted cell
If you do not set the percentage format in a cell and directly type a number with the "%" symbol, like "11%", then the percentage format is set automatically.
Case 6: Doubleclicking a cell and inserting number
If a percentageformatted cell is double clicked and a number is inserted in the celledit mode, the number is converted to the percentage format first and the % symbol is added to it. That is, if we doubleclick the cell and add 45, it formats to 4500.00%.
Case 7: Adding + or  symbols with numbers
You can add + or – symbols before the number in a percentageformatted cell. For example, +2 becomes 2.00% and 5 becomes 5.00%.
This example depicts the use of percentage formatting in Spreadsheet cells.
JavaScript 
Copy Code


// For Range A1:F10, set formatter for (var i = 0; i < 10; i++) for (var j = 0; j < 6; j++) activeSheet.getCell(i, j).formatter("0.00%"); 