Description: When I tried to access the named range when the formula syntax was "Excel R1C1" an exception was thrown. The example file is attached. Here is the problem: getCellRangeByName("NamedRange1") Steps to Reproduce: 1. Go to Tools, Options, LibreOffice Calc, Formula and select "Calc R1C1" in the Formula syntax dropdown menu. 2. Run the macro "Main" in the attached file. 3. Referring to a named range throws an error. Actual Results: Error #1 intercepted. Expected Results: No errors occured. The error disappears when you select "Calc A1" in the Formula syntax dropdown menu. Reproducible: Always User Profile Reset: No Additional Info: The same thing happens on Windows 10 and Linux Ubuntu 18.04 LTS.
Created attachment 167807 [details] Explains the error in detail Everything is clear
Created attachment 167840 [details] Explains the error in detail
Confirmed. RuntimeException is thrown when I use either of "Excel A1" or "Excel R1C1" I put some SAL_INFO macros to see what's happening. Though I haven't looked the source closer, https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/address.cxx?r=1250aecd&fi=ConvertSingleRef#1149 SAL_INFO("sc.core", OUString(p)); showed $Sheet1.$A$1 for "Calc A1", SAL_INFO("sc.core", OUString(p)); showed Sheet1!$A$1 for both "Excel A1" and "Excel R1C1". This can be problematic here, I guess. https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/address.cxx?r=1250aecd&fi=ConvertSingleRef#1185
https://opengrok.libreoffice.org/xref/core/sc/source/ui/unoobj/cellsuno.cxx?r=1c027848#4758
https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/rangeutl.cxx?r=1da69081#295 https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/rangeutl.cxx?r=1da69081#309
https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/rangeutl.cxx?r=1da69081&fi=MakeRangeFromName#279 https://opengrok.libreoffice.org/xref/core/sc/inc/rangenam.hxx?r=b49dada8#129 we can see from the GetSymbol's definition that the default value for the optional second parameter is formula::FormulaGrammar::GRAM_DEFAULT. This may be the culprit.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/1bdef3250fc57ea3f9b69a1f55ceb035329b6fa9 tdf#138646 - consider the document's address convention It will be available in 7.2.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.
Credits go to himajin100000@gmail.com for the code pointers, too!
Andreas Heinisch committed a patch related to this issue. It has been pushed to "libreoffice-7-1": https://git.libreoffice.org/core/commit/08cfec4a6e27ebc078345c57a7a74b2dffeb5b41 tdf#138646 - consider the document's address convention It will be available in 7.1.3. 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.