Bug 160889 - Macro Inserting SUM function results in 508 error.
Summary: Macro Inserting SUM function results in 508 error.
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
24.2.2.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-01 14:02 UTC by Don
Modified: 2024-05-01 14:58 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 Don 2024-05-01 14:02:35 UTC
Description:
A Macro inserting the SUM of two cells, separated by a comma instead of a range, results in a 508 error when there is nothing wrong with the formula.



Steps to Reproduce:
1. Use a macro to insert a SUM function, such as "=SUM(A1, A2)"
2. Or Run the below Macro.

Sub Main
Doc = ThisComponent
 Sheet = Doc.sheets.getByIndex(0)
 oCell = Sheet.Spreadsheet.getCellByPosition(1,0)
 oCell.setValue(3)
  oCell = Sheet.Spreadsheet.getCellByPosition(1,1)
 oCell.setValue(2)
oCell = Sheet.Spreadsheet.getCellByPosition(2,2)
oCell.setFormula("=SUM(B1, B2)")
End Sub

3.

Actual Results:
Cell reports a 508 Error, when both leading and trailing brackets are present.

Expected Results:
Cell should show the SUM of cells indicated.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.2.2.2 (X86_64) / LibreOffice Community
Build ID: d56cc158d8a96260b836f100ef4b4ef25d6f1a01
CPU threads: 2; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 1 Mike Kaganski 2024-05-01 14:13:14 UTC
This is not a bug. The formula that you define using setFormula must use ODF syntax - it means not only English function names, but also e.g. semicolons as argument separators, not commas. This requirement allows creating macros working independently of current settings.

oCell.setFormula("=SUM(B1; B2)")
Comment 2 Don 2024-05-01 14:58:49 UTC
My apologies, I failed to reference the help file, and was only going by the tooltip displayed when inserting a SUM function. I will be more careful in the future.