Kaydet (Commit) 1f970c20 authored tarafından Mike Kaganski's avatar Mike Kaganski

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: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst a06f4c9c
......@@ -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<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();
......
......@@ -5738,6 +5738,7 @@ void ScInterpreter::ScCountIf()
}
break;
default:
PopError(); // Propagate it further
PushIllegalParameter();
return ;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment