summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2020-12-29 08:36:49 +0100
committerEike Rathke <erack@redhat.com>2021-01-07 01:51:37 +0100
commit9e82c64fa54ce7c0ef18e9de5a06e1243a3a7e44 (patch)
treefb6f84f5046e90ec4ad513d9a17148e41d9355c8
parentd29de0b38ef6854bb129e82fd280f33b0d5b9a08 (diff)
tdf#139394 XLSX export: remove extra quotation marks
This fixes commit 583e2bfba2d72ac8afe7261c23f380daf5486889 (tdf#139021 XLSX export: fix "contains" conditional formatting). Change-Id: Idae3190b5f87dac551251da19c511f501bdaaa21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108452 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> Reviewed-by: Eike Rathke <erack@redhat.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108808 Tested-by: Jenkins
-rw-r--r--sc/qa/unit/data/xlsx/tdf139394.xlsxbin0 -> 9778 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx27
-rw-r--r--sc/source/filter/excel/xeextlst.cxx20
3 files changed, 37 insertions, 10 deletions
diff --git a/sc/qa/unit/data/xlsx/tdf139394.xlsx b/sc/qa/unit/data/xlsx/tdf139394.xlsx
new file mode 100644
index 000000000000..eac83fb2f3a8
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf139394.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index d354de27a7c4..35d349fdbee5 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -89,6 +89,7 @@ public:
virtual void tearDown() override;
void test();
+ void testTdf139394();
void testExtCondFormatXLSX();
void testTdf90104();
void testTdf111876();
@@ -279,6 +280,7 @@ public:
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
+ CPPUNIT_TEST(testTdf139394);
CPPUNIT_TEST(testExtCondFormatXLSX);
CPPUNIT_TEST(testTdf90104);
CPPUNIT_TEST(testTdf111876);
@@ -517,6 +519,31 @@ void ScExportTest::test()
xDocSh->DoClose();
}
+void ScExportTest::testTdf139394()
+{
+ ScDocShellRef xShell = loadDoc(u"tdf139394.", FORMAT_XLSX);
+ CPPUNIT_ASSERT(xShell.is());
+
+ ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+ CPPUNIT_ASSERT(xDocSh.is());
+
+ std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
+ xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml");
+ CPPUNIT_ASSERT(pDoc);
+
+ assertXPathContent(pDoc,
+ "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[1]/"
+ "x14:cfRule/xm:f", "LEFT(A1,LEN(\"+\"))=\"+\"");
+ assertXPathContent(pDoc,
+ "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[2]/"
+ "x14:cfRule/xm:f", "RIGHT(A2,LEN(\"-\"))=\"-\"");
+ assertXPathContent(pDoc,
+ "/x:worksheet/x:extLst/x:ext/x14:conditionalFormattings/x14:conditionalFormatting[3]/"
+ "x14:cfRule/xm:f", "LEFT(A3,LEN($B$3))=$B$3");
+
+ xDocSh->DoClose();
+}
+
void ScExportTest::testExtCondFormatXLSX()
{
ScDocShellRef xShell = loadDoc("tdf139021.", FORMAT_XLSX);
diff --git a/sc/source/filter/excel/xeextlst.cxx b/sc/source/filter/excel/xeextlst.cxx
index a1732197501e..610f25a1d894 100644
--- a/sc/source/filter/excel/xeextlst.cxx
+++ b/sc/source/filter/excel/xeextlst.cxx
@@ -174,16 +174,16 @@ OString GetFixedFormula(ScConditionMode eMode, const ScAddress& rAddress, const
OString aPos = aBuffer.makeStringAndClear();
switch (eMode)
{
- case ScConditionMode::BeginsWith:
- return OString("LEFT(" + aPos + ",LEN(" + rText + "))=\"" + rText + "\"");
- case ScConditionMode::EndsWith:
- return OString("RIGHT(" + aPos + ",LEN(" + rText + "))=\"" + rText + "\"");
- case ScConditionMode::ContainsText:
- return OString("NOT(ISERROR(SEARCH(" + rText + "," + aPos + ")))");
- case ScConditionMode::NotContainsText:
- return OString("ISERROR(SEARCH(" + rText + "," + aPos + "))");
- default:
- break;
+ case ScConditionMode::BeginsWith:
+ return OString("LEFT(" + aPos + ",LEN(" + rText + "))=" + rText);
+ case ScConditionMode::EndsWith:
+ return OString("RIGHT(" + aPos + ",LEN(" + rText + "))=" + rText);
+ case ScConditionMode::ContainsText:
+ return OString(OString::Concat("NOT(ISERROR(SEARCH(") + rText + "," + aPos + ")))");
+ case ScConditionMode::NotContainsText:
+ return OString(OString::Concat("ISERROR(SEARCH(") + rText + "," + aPos + "))");
+ default:
+ break;
}
return "";