formula/source/core/api/token.cxx | 2 +- sc/qa/unit/data/xlsb/tdf94627.xlsb |binary sc/qa/unit/subsequent_filters_test5.cxx | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-)
New commits: commit 96cca31589adf074326bbb610c7f0841d05e1420 Author: Markus Mohrhard <[email protected]> AuthorDate: Wed Aug 13 00:50:08 2025 +0800 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Aug 14 09:55:10 2025 +0200 tdf#94627: handle range name references in formulas during XLSB import Change-Id: I9e4f66e633740950cb568a589fd461a2b737c157 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189450 Reviewed-by: Eike Rathke <[email protected]> Tested-by: Jenkins Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189526 diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 10f91aad2450..dffcb1b3ff26 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -416,7 +416,7 @@ bool FormulaTokenArray::AddFormulaToken( { // long is svIndex, used for name / database area, or "byte" for spaces sal_Int32 nValue = rToken.Data.get<sal_Int32>(); - if ( eOpCode == ocDBArea ) + if ( eOpCode == ocDBArea || eOpCode == ocName ) Add( new formula::FormulaIndexToken( eOpCode, static_cast<sal_uInt16>(nValue) ) ); else if ( eOpCode == ocSpaces ) Add( new formula::FormulaByteToken( ocSpaces, static_cast<sal_uInt8>(nValue) ) ); diff --git a/sc/qa/unit/data/xlsb/tdf94627.xlsb b/sc/qa/unit/data/xlsb/tdf94627.xlsb new file mode 100644 index 000000000000..273085f7a2a0 Binary files /dev/null and b/sc/qa/unit/data/xlsb/tdf94627.xlsb differ diff --git a/sc/qa/unit/subsequent_filters_test5.cxx b/sc/qa/unit/subsequent_filters_test5.cxx index 910fcb7956cf..46d16c34648a 100644 --- a/sc/qa/unit/subsequent_filters_test5.cxx +++ b/sc/qa/unit/subsequent_filters_test5.cxx @@ -204,6 +204,23 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest5, testTdf151505) CPPUNIT_ASSERT(nFlag & ScMF::Auto); } +CPPUNIT_TEST_FIXTURE(ScFiltersTest5, testTdf94627) +{ + createScDoc("xlsb/tdf94627.xlsb"); + + ScDocument* pDoc = getScDoc(); + + ScRangeName* pRangeName = pDoc->GetRangeName(); + ScRangeData* pRangeData = pRangeName->findByUpperName("NAME1"); + CPPUNIT_ASSERT(pRangeData); + + OUString aFormula = pRangeData->GetSymbol(); + CPPUNIT_ASSERT_EQUAL(u"$Sheet1.$A$1"_ustr, aFormula); + + double fVal = pDoc->GetValue(0, 3, 0); + ASSERT_DOUBLES_EQUAL(2, fVal); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
