problem with formala inserted by macros when decimal separator is comma

Hello,

The problem is in LO 4.1 and LO4.1.1 with lt_LT locale but i think the same
must be in all locales with decimal separated by comma.

I want to insert formula to Calc cell by Basic macros:

cell.setFormula("=2.1*2")

Old behavior (LO 4.0 and older). In cell I get result 4,2 (and formula
"=2,1*2")

New behavior (LO 4.1). In cell I get error "#NAME?" (and formula "2.1*2")

But if I want insert value, decimal separator is translated correctly:

cell.setValue(2.1)

In cell I get value 2,1 (LO 4.0, LO 4.1)
  
It's bug or new feature?

Best regards

Mindaugas

I am not properly set to test this, but, can you test the following in older and newer LO?
cell.FormulaLocal = "=2,1*2"
cell.FormulaLocal = "=2.1*2"

I am a very unhappy about that I think. That is a pretty major change in behavior. I had documented it as follows:

When setting a cell’s formula, you must include the leading equals sign (=) and the formula must be in English. To set a formula using your own local language, use the FormulaLocal property shown in Table 166.

It sounds like things changed so that setting the formula now acts like setting FormulaLocal. Off hand I would call it a bug.

In 4.0 the properties Formula and FormulaLocal give the expected result:

cell.Formula = "=2.1*2" => 4,2
cell.Formula = "=2,1*2" => #NAME?

cell.FormulaLocal = "=2,1*2" => 4,2
cell.FormulaLocal = "=2.1*2" => #NAME?

In 4.1 the both properties Formula and FormulaLocal give the same result:

cell.Formula = "=2,1*2" => 4,2
cell.Formula = "=2.1*2" => #NAME?

cell.FormulaLocal = "=2,1*2" => 4,2
cell.FormulaLocal = "=2.1*2" => #NAME?

Best regards

Mindaugas

Best regards

Thank you very much,

This is exactly what I wanted to know. I was not able to run that test myself.

seems that you are not the first to see this bug. Consider adding yourself to the CC list. I dropped an email to the dev list to see if I can figure out who introduced the bug.

https://bugs.freedesktop.org/show_bug.cgi?id=67836

This has now been verified as a bug by the developers.