Created
February 21, 2018 00:50
-
-
Save natergj/f6a039a268436a783870be322f835804 to your computer and use it in GitHub Desktop.
display currency in Indian format in excel4node
This file contains hidden or 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'); | |
var indianCurrency = wb.createStyle({ | |
numberFormat: '[>=10000000]"RS "##\\,##\\,##\\,##0;[>=100000]"RS "\\ ##\\,##\\,##0;"RS "##,##0', | |
}); | |
ws.column(1).setWidth(15); | |
ws.cell(1,1).number(12.34).style(indianCurrency); // displays as "RS 12" | |
ws.cell(2,1).number(1234.56).style(indianCurrency); // displays as "RS 1,235" | |
ws.cell(3,1).number(12345.67).style(indianCurrency); // displays as "RS 12,346" | |
ws.cell(4,1).number(1234567.89).style(indianCurrency); // displays as "RS 12,34,568" | |
ws.cell(5,1).number(123456789.01).style(indianCurrency); // displays as "RS 12,34,56,789" | |
wb.write('NumFormat.xlsx'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment