https://bugs.documentfoundation.org/show_bug.cgi?id=150203
Bug ID: 150203
Summary: Impossible to call RANDBETWEEN using FunctionAccess
when UI language is not English
Product: LibreOffice
Version: 7.3.1.3 release
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Calc
Assignee: [email protected]
Reporter: [email protected]
In Calc, if your language is set to English and run the following macro,
everything works and a random number between 0 and 100 is shown.
Sub FunctionAccessTest
Dim fa As Object
fa = CreateUnoService("com.sun.star.sheet.FunctionAccess")
result = fa.callFunction("RANDBETWEEN", Array(0, 100))
MsgBox result
End Sub
However, if you change the UI language (via Tools - Options - Language
settings) to a language that is not English, the macro above will not run and a
NoSuchElementException exception will be raised.
Interestingly changing RANDBETWEEN for RANDBETWEEN.NV in the macro above will
work. But both of them should work (RANDBETWEEN and RANDBETWEEN.NV in any
language).
This bug affects a method from the ScriptForge library, more specifically the
GetTempName method from the FileSystem service, which relies on calling
RANDBETWEEN. Because of this bug, GetTempName only works in English, but fails
in other languages. Below is a sample code for testing the GetTempName error.
Sub TestTempName
GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")
fs = CreateScriptService("FileSystem")
MsgBox fs.GetTempName()
End sub
In summary, the problem appears to be in the handling of the RANDBETWEEN
function by the FunctionAccess service and not in ScriptForge itself. This is
why I reported this as a Calc bug.
System info
Version: 7.3.4.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 12; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: pt-BR
Ubuntu package version: 1:7.3.4-0ubuntu0.22.04.1
Calc: threaded
--
You are receiving this mail because:
You are the assignee for the bug.