sc/source/core/tool/compiler.cxx | 5 ++++- sc/source/filter/excel/xename.cxx | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
New commits: commit d7c06bd82504c66aad79edc2193827b23ba47481 Author: Karthik Godha <[email protected]> AuthorDate: Wed Jan 21 20:58:19 2026 +0530 Commit: Michael Stahl <[email protected]> CommitDate: Thu Jan 22 16:44:12 2026 +0100 tdf#170292: R1C1 reference style in defined names Defined names can't contian R1C1 references as name bug-document: forum-mso-de-23552.xls Change-Id: I4798b783cc1e1d84c04d236a11710bd778c6af49 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197762 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index e610e758a892..85a599366d04 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -5809,7 +5809,10 @@ void ScCompiler::CreateStringFromIndex( OUStringBuffer& rBuffer, const FormulaTo } OUString sName = pData->GetName(); // If the name is a valid reference then add underscore to the name - if (ScAddress().Parse(sName, rDoc, FormulaGrammar::CONV_XL_A1) & ScRefFlags::VALID) + if ((ScAddress().Parse(sName, rDoc, ::formula::FormulaGrammar::CONV_XL_A1) + != ScRefFlags::ZERO) + || (ScRange().Parse(sName, rDoc, ::formula::FormulaGrammar::CONV_XL_R1C1) + != ScRefFlags::ZERO)) sName = "_" + sName; aBuffer.append(sName); } diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 7d8de704b8a5..9e9ce1bd2a00 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -356,8 +356,10 @@ void XclExpName::SaveXml( XclExpXmlStream& rStrm ) else { // If the name is a valid reference then add underscore to the name - if (ScAddress().Parse(sName, GetDoc(), ::formula::FormulaGrammar::CONV_XL_A1) - & ScRefFlags::VALID) + if ((ScAddress().Parse(sName, GetDoc(), ::formula::FormulaGrammar::CONV_XL_A1) + != ScRefFlags::ZERO) + || (ScRange().Parse(sName, GetDoc(), ::formula::FormulaGrammar::CONV_XL_R1C1) + != ScRefFlags::ZERO)) sName = "_" + sName; }
