Bug 82610 - CALC: MACRO: ADD-IN FUNCTIONS: 'add-in' functions can't be set from a macro | was: DEC2HEX function not working in macro, Affects Analysis AddIn functions.
Summary: CALC: MACRO: ADD-IN FUNCTIONS: 'add-in' functions can't be set from a macro |...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro-UNOAPI
  Show dependency treegraph
 
Reported: 2014-08-14 09:12 UTC by oligo92
Modified: 2021-12-17 09:53 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description oligo92 2014-08-14 09:12:06 UTC
Hello,

when I run the following code, the selected cell shows “#NAME?” and its content shows “=dec2hex(A1)” (with lowercases!)

dim oSel as object
oSel=ThisComponent.currentSelection
oSel.Formula="=DEC2HEX(A1)"
Comment 1 raal 2014-11-11 19:43:10 UTC
I can confirm with Version: 4.3.4.0.0+
Build ID: e812aaaf31050c29a9499d3936cf07079b1a5f86
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:libreoffice-4-3, Time: 2014-11-10_10:51:25

Reproducible with Win7, LO 4.3.3

LibreOffice 3.5.0 Build ID: d6cde02 is oldest version where I can reproduce the problem

When I change macro, for example oSel.Formula="=SUM(A1)", then formula is correct.
Comment 2 LeMoyne Castle 2015-02-12 07:48:32 UTC
Reproduced in LibreOffice 3.5.7.2 with Build ID: 350m1(Build:2) 
and in 4.5.0.0 built from recent master running on Ubuntu 12.04 

Occurs also for DEC2OCT and DEC2BIN. 
Is an issue with all Add-In functions?
Comment 3 LeMoyne Castle 2015-02-17 06:56:53 UTC
Affects Analysis AddIn functions.

*** This bug has been marked as a duplicate of bug 78929 ***
Comment 4 raal 2015-02-17 07:46:17 UTC
Setting back to NEW. Examples from Bug 78929 are solved, bug 78929 is solved -> no Err:508.


oSheet.getCellByPosition(2, 0).setFormula("= DEC2HEX(A1)") -> error  #NAME?
Comment 5 Jacques Guilleron 2015-02-20 11:07:49 UTC
Hello oligo92, raal,

You a
Comment 6 Jacques Guilleron 2015-02-20 11:26:15 UTC
Hello oligo92, raal,

Did you try to use DECHEX, function name into LibreOffice, instead of DEC2HEX?
The same I think for DECOCT a
 
Regards,

Jacques
Comment 7 raal 2015-02-20 11:36:31 UTC
(In reply to Jacques Guilleron from comment #6)
> Did you try to use DECHEX, function name into LibreOffice, instead of
> DEC2HEX?

Hello,
I doesn't see DECHEX in list of available functions. Lo 4.4.0.3
Comment 8 tommy27 2016-04-16 07:29:02 UTC Comment hidden (obsolete)
Comment 9 QA Administrators 2017-05-22 13:27:29 UTC Comment hidden (obsolete)
Comment 10 oligo92 2017-05-22 15:41:36 UTC
This bug it still in v5.3.3.2
Checked on Linux & Windows
Comment 11 raal 2017-05-22 16:42:14 UTC
version is oldest
Comment 12 QA Administrators 2018-05-23 02:35:29 UTC Comment hidden (obsolete)
Comment 13 Buovjaga 2019-08-11 11:28:07 UTC
Still repro.

Arch Linux 64-bit
Version: 6.4.0.0.alpha0+
Build ID: 37fc9f51a8de11d40632e8cda17ccf1fa4b1f503
CPU threads: 8; OS: Linux 5.2; UI render: default; VCL: gtk3; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 6 August 2019
Comment 14 b. 2020-02-20 09:02:13 UTC
in c#3: LeMoyne Castle wrote: 

"Affects Analysis AddIn functions."

in long: looks as if 'add-in' functions as DEC2HEX, DELTA, GESTEP ... 

are handeled differently to 'built-in'? functions as SUM or AVERAGE, 

thus a more general problem, i change the title, 

as manually keying in of 'add-in' functions works, 
and as setting of cells to plenty other functions (formulas) by a macro works, 
and as even setting cells to values "3" or strings "text" works from macros, 
and as even after a 'failed' setting with result "=dec2hex(A1)" a 'nonchanging edit' as 'adding-a-space-and-delete-before-enter' produces a functioning function,   

i see no reason why setting an 'add-in' function by a macro should fail ... 

... but it fails ... anybody an idea why? 

the string/cell set by the macro must contain some 'special' 'hidden' property??, it can be copied to another cell with result there still 'bad', but if you copy the text from the formula bar into another cell it's capitalized to "=DEC2HEX(A1)" and works as expected, 

one more funny effect: the unchanging edit 'add-a-space-and-delete-before-enter' works to heal the defects in this case, while other unchanging edits as 'delete-and-undo' or 'replace-and-undo' which helped for some other fails don't help here ???

tests above done with and still repro in: 

Version: 7.0.0.0.alpha0+ (x64)
Build ID: 07b1159b79135857dd9a450c3bb9ae0a944ebcf9
CPU threads: 8; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: default; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-US
Calc: 

reg. 

b.
Comment 15 Mike Kaganski 2021-12-17 09:53:26 UTC
This is not a bug.

As explained in help [1], all add-in functions (including DEC2HEX) must use a specific syntax (like "com.sun.star.sheet.addin.Analysis.getDec2Hex", not "DEC2HEX"), when passed to setFormula. This is explained in bug 54854 comment 29, and Olivier has improved that help page for version 7.3 to mention the syntax for setting formulas [2].

[1] https://help.libreoffice.org/7.2/en-US/text/sbasic/shared/calc_functions.html?DbPAR=BASIC

[2] https://help.libreoffice.org/7.3/en-US/text/sbasic/shared/calc_functions.html?DbPAR=BASIC