my current cell’s formula is “=SUM(F4,F6)”
and the result of basic code
“ThisComponent.getCurrentSelection.formula” is “=SUM(F4;F6)”.
why comma is replaced with semicolon?
In quite a number of languages other than English decimal points are separated with comma, such as 0,5 (stands for English 0.5). Now imagine you want to write a similar equation to sum 0,4 and 0,6, but writing =SUM(0,4, 0,6)
would give you 10 instead of 1. Therefore localized LibreOffice uses different argument separators inside functions.
So the two following equations are exact equivalents:
=SUM(0.4, 0.6)
=SUM(0,4; 0,6)
So, is there any way to return the basic code’s result based on the localized argument separator?
The easiest way is to switch your locale to English, see Tools → Settings → Language settings and also Tools → Settings → Calc → Formula → Separators.
The “right” way would be to make your code work with both notations, see
http://listarchives.libreoffice.org/global/users/msg28363.html
and also
http://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=40890