summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-03-07 16:38:20 +0300
committerEike Rathke <erack@redhat.com>2019-03-17 00:08:12 +0100
commit0a23bfacc46cb7c66ceb1bbec972cdcfa9afa50b (patch)
treebe0659922c0422a83103aeae55781cecfb528ee7 /sc
parent2358c867563731f56cefbf2a17818e69b15c2e66 (diff)
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.kaganski@collabora.com> (cherry picked from commit 1f970c20a25deed282dbaf08a4be5af25e4951db) Reviewed-on: https://gerrit.libreoffice.org/69273 Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/ods/pivot-table-err-in-cache.odsbin0 -> 9362 bytes
-rw-r--r--sc/qa/unit/pivottable_filters_test.cxx19
-rw-r--r--sc/source/core/tool/interpr1.cxx1
3 files changed, 20 insertions, 0 deletions
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
--- /dev/null
+++ b/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods
Binary files differ
diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx
index ceb43d6ce664..e68e34904b3d 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 d7279c1188a7..c9c3624bb019 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -5743,6 +5743,7 @@ void ScInterpreter::ScCountIf()
}
break;
default:
+ PopError(); // Propagate it further
PushIllegalParameter();
return ;
}