diff --git a/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods b/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods new file mode 100644 index 000000000000..b566a61f8898 Binary files /dev/null and b/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods differ diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 7697fdb20b48..5e737486d5b3 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -81,6 +81,7 @@ public: void testPivotTableDuplicatedMemberFilterXLSX(); void testPivotTableTabularModeXLSX(); void testTdf112106(); + void testTdf123923(); CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest); @@ -119,6 +120,7 @@ public: CPPUNIT_TEST(testPivotTableDuplicatedMemberFilterXLSX); CPPUNIT_TEST(testPivotTableTabularModeXLSX); CPPUNIT_TEST(testTdf112106); + CPPUNIT_TEST(testTdf123923); CPPUNIT_TEST_SUITE_END(); @@ -2326,6 +2328,23 @@ void ScPivotTableFiltersTest::testTdf112106() xDocSh->DoClose(); } +void ScPivotTableFiltersTest::testTdf123923() +{ + // tdf#123923: Excel fails when it finds "Err:504" instead of "#REF!" in pivot table cache + + ScDocShellRef xShell = loadDoc("pivot-table-err-in-cache.", FORMAT_ODS); + CPPUNIT_ASSERT(xShell.is()); + + std::shared_ptr pXPathFile + = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, + "xl/pivotCache/pivotCacheDefinition1.xml"); + CPPUNIT_ASSERT(pTable); + + assertXPath(pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems/x:e", + "v", "#REF!"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index bc57c63388ae..75fd8f82b874 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -5738,6 +5738,7 @@ void ScInterpreter::ScCountIf() } break; default: + PopError(); // Propagate it further PushIllegalParameter(); return ; }