sc/qa/unit/data/xlsx/tdf142929.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 17 +++++++++++++++++ sc/source/filter/oox/autofilterbuffer.cxx | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-)
New commits: commit c66c1fce6d7ded277b46410bd4162cfba2629a3f Author: Tünde Tóth <[email protected]> AuthorDate: Thu Jul 1 13:40:03 2021 +0200 Commit: Gabor Kelemen <[email protected]> CommitDate: Wed Sep 1 13:46:03 2021 +0200 tdf#142929 XLSX: fix import of "Less than" filter condition "Less than" standard filter condition became <> instead of <. Change-Id: I53435590de3a03d9fcaf0359e8421ae3ef941316 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118227 Tested-by: Jenkins Tested-by: László Németh <[email protected]> Reviewed-by: László Németh <[email protected]> (cherry picked from commit 0d3398e5d141b79706653c04f1ab6dc9381a5cc1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118809 Reviewed-by: Eike Rathke <[email protected]> (cherry picked from commit bbd4d7c1b8a219cd295fd799d39b9cbb7a5b464d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121422 Tested-by: Gabor Kelemen <[email protected]> Reviewed-by: Gabor Kelemen <[email protected]> diff --git a/sc/qa/unit/data/xlsx/tdf142929.xlsx b/sc/qa/unit/data/xlsx/tdf142929.xlsx new file mode 100644 index 000000000000..6bf23b951360 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf142929.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 1f3c177ca26e..da114d4334d8 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -286,6 +286,7 @@ public: void testTdf139258_rotated_image(); void testTdf140431(); void testDateStandardfilterXLSX(); + void testTdf142929_filterLessThanXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -471,6 +472,7 @@ public: CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testDateStandardfilterXLSX); + CPPUNIT_TEST(testTdf142929_filterLessThanXLSX); CPPUNIT_TEST_SUITE_END(); private: @@ -5947,6 +5949,21 @@ void ScExportTest::testDateStandardfilterXLSX() xDocSh->DoClose(); } +void ScExportTest::testTdf142929_filterLessThanXLSX() +{ + // Document contains a standard filter with '<' condition. + ScDocShellRef xDocSh = loadDoc(u"tdf142929.", FORMAT_XLSX); + CPPUNIT_ASSERT(xDocSh.is()); + + xmlDocUniquePtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, + "xl/worksheets/sheet1.xml", FORMAT_XLSX); + CPPUNIT_ASSERT(pDoc); + assertXPath(pDoc, "//x:customFilters/x:customFilter", "val", "2"); + assertXPath(pDoc, "//x:customFilters/x:customFilter", "operator", "lessThan"); + + xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/oox/autofilterbuffer.cxx b/sc/source/filter/oox/autofilterbuffer.cxx index e09bd084e7f3..ed5592ab5b83 100644 --- a/sc/source/filter/oox/autofilterbuffer.cxx +++ b/sc/source/filter/oox/autofilterbuffer.cxx @@ -69,7 +69,7 @@ bool lclGetApiOperatorFromToken( sal_Int32& rnApiOperator, sal_Int32 nToken ) { switch( nToken ) { - case XML_lessThan: rnApiOperator = FilterOperator2::NOT_EQUAL; return true; + case XML_lessThan: rnApiOperator = FilterOperator2::LESS; return true; case XML_equal: rnApiOperator = FilterOperator2::EQUAL; return true; case XML_lessThanOrEqual: rnApiOperator = FilterOperator2::LESS_EQUAL; return true; case XML_greaterThan: rnApiOperator = FilterOperator2::GREATER; return true;
