Ask Your Question

There's a way to add a given currency?

asked 2017-05-22 00:37:31 +0100

Daanik gravatar image


I would like to make some balances and calc do not have bitcoin as a currency. So there's any way for me to add it in calc's currencys list?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2017-05-22 08:55:33 +0100

librebel gravatar image

updated 2017-05-22 08:56:50 +0100

Hello Daanik, yes it is possible to add your own currency format to your "Number Formats" in Calc.

If you select the menu "Format : Cells..." (tab Numbers), there in the editfield called "Format Code" you could write for example the following code for Bitcoin currency values:

[$BTC-001] #.##0,00000000;[RED][$BTC-001] -#.##0,00000000

Then click on the green checkmark button to save it.

NB. please note that the above example uses the dot as thousands-separator, and the comma as decimal separator. It might be different for another locale.

edit flag offensive delete link more


An unsolicited remark: The widespread way of displaying "currency" is a misguidance concerning the informatiomn.available as data. You keep a format property of no more informational content as a "light gray background" as if it codes for the very relevant currency information. 1USD = 1INR this way.
Better: Explicate the currency in the column header or use an extra column for it.

(There is no way based on standard functions to ask a cell for the currency.applied to its value.)

Lupp gravatar imageLupp ( 2017-05-22 09:30:46 +0100 )edit

One could ask the cell for the NumberFormat applied to it, e.g.

NF = ThisComponent.getNumberFormats().getByKey( oCell.NumberFormat )

and then look at the values of NF.CurrencySymbol, NF.CurrencyExtension, NF.CurrencyAbbreviation

librebel gravatar imagelibrebel ( 2017-05-22 10:01:10 +0100 )edit

Of course, there are means to get the information via the api. " way based on standard functions..." was supposed to include "...of Calc". Methods of api objects were not included.
(There should be some posts concerning user functions for cell introspection. One of the disadvantages is the problem of passing the information what cell should be looked in. No way to get zjis done by a standard reference like A$1 which always results in a dereferenced 'Double' or 'String or a 'DataArray'.)

Lupp gravatar imageLupp ( 2017-05-22 11:55:26 +0100 )edit

answered 2017-05-23 00:22:54 +0100

Daanik gravatar image

Thanks man, it was useful.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-05-22 00:37:31 +0100

Seen: 521 times

Last updated: May 23 '17