Created
February 13, 2018 00:12
-
-
Save natergj/8089af76e795a09e20e04619f2447414 to your computer and use it in GitHub Desktop.
display cells as percentage in excel4node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xl = require('excel4node'); | |
var wb = new xl.Workbook(); | |
var ws = wb.addWorksheet('test'); | |
// Create a reusable style | |
var style = wb.createStyle({ | |
numberFormat: '#.00%; -#.00%; -' | |
}); | |
ws.cell(1,1).number(10).style(style); // displays as 1000.00% | |
ws.cell(2,1).number(1).style(style); // displays as 100.00% | |
ws.cell(3,1).number(.1).style(style); // displays as 10.00% | |
ws.cell(4,1).number(.001).style(style); // displays as .10% | |
wb.write('NumFormat.xlsx'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice! helped me there