sc/qa/unit/data/xlsx/tdf142929.xlsx       |binary
 sc/qa/unit/subsequent_export-test2.cxx    |   17 +++++++++++++++++
 sc/source/filter/oox/autofilterbuffer.cxx |    2 +-
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit bbd4d7c1b8a219cd295fd799d39b9cbb7a5b464d
Author:     Tünde Tóth <[email protected]>
AuthorDate: Thu Jul 1 13:40:03 2021 +0200
Commit:     Eike Rathke <[email protected]>
CommitDate: Wed Jul 14 10:32:31 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]>

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-test2.cxx 
b/sc/qa/unit/subsequent_export-test2.cxx
index 47a50a3d8ee6..55faefb0ddb3 100644
--- a/sc/qa/unit/subsequent_export-test2.cxx
+++ b/sc/qa/unit/subsequent_export-test2.cxx
@@ -188,6 +188,7 @@ public:
     void testTdf139258_rotated_image();
     void testTdf126541_SheetVisibilityImportXlsx();
     void testTdf140431();
+    void testTdf142929_filterLessThanXLSX();
 
     CPPUNIT_TEST_SUITE(ScExportTest2);
 
@@ -284,6 +285,7 @@ public:
     CPPUNIT_TEST(testTdf139258_rotated_image);
     CPPUNIT_TEST(testTdf126541_SheetVisibilityImportXlsx);
     CPPUNIT_TEST(testTdf140431);
+    CPPUNIT_TEST(testTdf142929_filterLessThanXLSX);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2320,6 +2322,21 @@ void ScExportTest2::testTdf140431()
     xDocSh->DoClose();
 }
 
+void ScExportTest2::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(ScExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/oox/autofilterbuffer.cxx 
b/sc/source/filter/oox/autofilterbuffer.cxx
index 8eb24f231bd4..ab0ff9a43c68 100644
--- a/sc/source/filter/oox/autofilterbuffer.cxx
+++ b/sc/source/filter/oox/autofilterbuffer.cxx
@@ -77,7 +77,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;
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to