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
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)")
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.