sc/source/core/tool/compiler.cxx | 5 ++++- sc/source/filter/excel/xename.cxx | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-)
New commits: commit 52a14d417afbcd9abe82abb171c20b34193c0714 Author: Karthik Godha <[email protected]> AuthorDate: Wed Jan 21 20:58:19 2026 +0530 Commit: Karthik Godha <[email protected]> CommitDate: Mon Feb 16 04:47:58 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]> (cherry picked from commit d7c06bd82504c66aad79edc2193827b23ba47481) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199421 Reviewed-by: Karthik Godha <[email protected]> Tested-by: Jenkins diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index c9e81883fb0a..2c14e871efcc 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -5855,7 +5855,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; }
