Formatters can be chained with dynamic parameters to create complex operations, check out the example in Dynamic parameters.
converts from one currency to another
exchange rates are included by default
you can provide a new exchange rate for one report in options.currencyRates
of Carbone.render
or globally with Carbone.set
convCurr()
without parameters converts automatically from options.currencySource
to options.currencyTarget
rounds a number
same as toFixed()
but it rounds number correctly round(1.05, 1) = 1.1
formats number according to the locale
applying a number of decimals depends on the report type:
for ODS
/XLSX
, the number of decimals has to be formatted based on the text editor
for the other type of files, the number of decimals depends on the precision
parameter passed to the formatter
Adds 2 numbers.
Subtracts 2 numbers.
Multiplies 2 numbers.
Divides 2 numbers.
Converts a number to an INT.
Converts a number with English specifications (decimal separator is a dot .
).
Converts a number into string, keeping only decimals.
Converts a number with French specifications (decimal separator is a comma ,
).
Parameters | Description | Type |
---|---|---|
Parameters | Description | Type |
---|---|---|
Parameters | Description | Type |
---|---|---|
Parameters | Description | Type |
---|---|---|
target
[optional] convert to this currency ('EUR')
by default it equals options.currencyTarget
string
source
[optional] currency of source data ('USD')
by default it equals options.currencySource
string
precision
number of decimal
number
precision
[optional] number of decimals
number
precisionOrFormat
[optional] number of decimal, or specific format
integer : change default precision of the currency
M : print major currency name without the number
L : prints number with currency symbol (by default)
LL : prints number with major currency name
number