Bug 150253 - XCell::setFormula() for AddIn functions works only with programmatic name
Summary: XCell::setFormula() for AddIn functions works only with programmatic name
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:7.5.0 target:7.4.1
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-03 19:05 UTC by Eike Rathke
Modified: 2022-08-13 11:27 UTC (History)
0 users

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 Eike Rathke 2022-08-03 19:05:42 UTC
This macro leads to #NAME? error because the EDATE name is not recognized as it is implemented as an AddIn function and the formula API for XCell::setFormula() for AddIns handles only the PODF programmatic names due to legacy reasons:

> Sub Main
> row=3
> ThisComponent.Sheets.getByIndex(0).getCellByPosition(3,row-1).setFormula("=EDATE($B"&(row)&";$C"&(row)&")")
> End Sub

Using the programmatic name com.sun.star.sheet.addin.Analysis.getEdate instead of EDATE works and yields the expected working =EDATE($B3;$C3) formula:

> Sub Main
> row=3
> ThisComponent.Sheets.getByIndex(0).getCellByPosition(3,row-1).setFormula("=com.sun.star.sheet.addin.Analysis.getEdate($B"&(row)&";$C"&(row)&")")
> End Sub

See also
https://ask.libreoffice.org/t/macro-edate-in-setformula-goes-lowercase/76996
https://ask.libreoffice.org/t/macro-edate-in-setformula-goes-lowercase/76996/14
Comment 1 Commit Notification 2022-08-04 00:51:44 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/86ed0105a4d70d481e3358ae1c6855766ef44d23

Resolves: tdf#150253 Add English names for GRAM_API AddIn functions

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 2 Commit Notification 2022-08-04 21:43:57 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a56d0c34716f381accbd9d2e3040a62d3583d18d

Add known but not in AddInMap English names for GRAM_API, tdf#150253 follow-up

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 3 Eike Rathke 2022-08-04 21:52:15 UTC
Pending review https://gerrit.libreoffice.org/c/core/+/137837 for 7-4
Comment 4 Commit Notification 2022-08-13 11:27:30 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/2f4e5b0b310a34a436998d8103c65e891ff2bff5

Resolves: tdf#150253 Add English names for GRAM_API AddIn functions

It will be available in 7.4.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.