sc/qa/unit/data/ods/pivot-table-err-in-cache.ods |binary sc/qa/unit/pivottable_filters_test.cxx | 19 +++++++++++++++++++ sc/source/core/tool/interpr1.cxx | 1 + 3 files changed, 20 insertions(+)
New commits: commit 0640e800c532cac0905412fe961efb03474ecc3f Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu Mar 7 16:38:20 2019 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Mar 11 18:33:02 2019 +0100 tdf#123923: make COUNTIF propagate errors in its first parameter In a specific case, Err:504 was emitted by COUNTIF when its 1st parameter was #REF!. This value was written into pivot cache definition when exporting to XLSX. Clearly Excel only expected propagated #REF! there, emitted error to user, and dropped the pivot table. This problem made XLSX pivot table cache generated by Calc unusable by Excel, despite ECMA-376 Part 1, 18.10.1.27 tells that the error value is application-dependent. The change makes COUNTIF to propagate errors received in its 1st parameter, instead of owerwriting them with own Err:504. This will likely need to be extended to other functions, if similar problems would arise. Change-Id: I459fa163a0e3e5f2c658631d66e096f4d46b1ace Reviewed-on: https://gerrit.libreoffice.org/68868 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> (cherry picked from commit 1f970c20a25deed282dbaf08a4be5af25e4951db) Reviewed-on: https://gerrit.libreoffice.org/69039 Tested-by: Mike Kaganski <mike.kagan...@collabora.com> 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 bb989d2b1b83..1a046296357f 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -84,6 +84,7 @@ public: void testPivotTableDuplicatedMemberFilterXLSX(); void testPivotTableTabularModeXLSX(); void testTdf112106(); + void testTdf123923(); CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest); @@ -122,6 +123,7 @@ public: CPPUNIT_TEST(testPivotTableDuplicatedMemberFilterXLSX); CPPUNIT_TEST(testPivotTableTabularModeXLSX); CPPUNIT_TEST(testTdf112106); + CPPUNIT_TEST(testTdf123923); CPPUNIT_TEST_SUITE_END(); @@ -2315,6 +2317,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<utl::TempFile> 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 cb0ac61a3cc6..bd5963bc1c97 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -5606,6 +5606,7 @@ void ScInterpreter::ScCountIf() } break; default: + PopError(); // Propagate it further PushIllegalParameter(); return ; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits