[Libreoffice-commits] core.git: 2 commits - sc/qa sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Jul 14 22:36:39 UTC 2018
sc/qa/unit/data/ods/conditionalformat_containstext.ods |binary
sc/qa/unit/subsequent_export-test.cxx | 13 +++++++++++++
sc/source/filter/excel/xecontent.cxx | 10 ++++++++++
3 files changed, 23 insertions(+)
New commits:
commit 7e8dbbb02f25278d5afc51ae4a397831f5b21239
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Sat Jul 14 15:29:41 2018 +0200
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Sun Jul 15 00:36:25 2018 +0200
add test for tdf#117816
Change-Id: I470b4137a3b4e23acf0f4e949a7a834fed8069db
Reviewed-on: https://gerrit.libreoffice.org/57433
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/qa/unit/data/ods/conditionalformat_containstext.ods b/sc/qa/unit/data/ods/conditionalformat_containstext.ods
new file mode 100644
index 000000000000..fa3e21e29f5a
Binary files /dev/null and b/sc/qa/unit/data/ods/conditionalformat_containstext.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 09364c8de62e..f6e151390a5e 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -107,6 +107,7 @@ public:
void testDataBarExportODS();
void testDataBarExportXLSX();
void testConditionalFormatRangeListXLSX();
+ void testConditionalFormatContainsTextXLSX();
void testMiscRowHeightExport();
void testNamedRangeBugfdo62729();
void testBuiltinRangesXLSX();
@@ -226,6 +227,7 @@ public:
CPPUNIT_TEST(testDataBarExportODS);
CPPUNIT_TEST(testDataBarExportXLSX);
CPPUNIT_TEST(testConditionalFormatRangeListXLSX);
+ CPPUNIT_TEST(testConditionalFormatContainsTextXLSX);
CPPUNIT_TEST(testMiscRowHeightExport);
CPPUNIT_TEST(testNamedRangeBugfdo62729);
CPPUNIT_TEST(testBuiltinRangesXLSX);
@@ -3876,6 +3878,17 @@ void ScExportTest::testConditionalFormatRangeListXLSX()
assertXPath(pDoc, "//x:conditionalFormatting", "sqref", "F4 F10");
}
+void ScExportTest::testConditionalFormatContainsTextXLSX()
+{
+ ScDocShellRef xDocSh = loadDoc("conditionalformat_containstext.", FORMAT_ODS);
+ CPPUNIT_ASSERT(xDocSh.is());
+
+ xmlDocPtr pDoc = XPathHelper::parseExport2(*this, *xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX);
+ CPPUNIT_ASSERT(pDoc);
+
+ assertXPathContent(pDoc, "//x:conditionalFormatting/x:cfRule/x:formula", "NOT(ISERROR(SEARCH(\"test\",A1)))");
+}
+
void ScExportTest::testEscapeCharInNumberFormatXLSX()
{
ScDocShellRef xDocSh = loadDoc("tdf81939.", FORMAT_XLSX);
commit e77596be879c25f5766b73a2f67cf0ddf7775ccc
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Sat Jul 14 15:16:46 2018 +0200
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Sun Jul 15 00:36:18 2018 +0200
tdf#117816, work around MS Excel bug with containsText cond format
Excel seems to require the formula that is equal to the containsText
condition.
According to cfRule (18.3.1.10) "Only rules with a type attribute
value of expression support formula syntax." which contradicts the
MS EXCEL behavior.
Change-Id: Ifa3f9fee58194f70a64b37c62922513435d43bb8
Reviewed-on: https://gerrit.libreoffice.org/57432
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index deb8f8dd2454..6d025f022eeb 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -998,6 +998,16 @@ void XclExpCFImpl::SaveXml( XclExpXmlStream& rStrm )
rWorksheet->endElement( XML_formula );
}
}
+ else if (IsTextRule(eOperation))
+ {
+ OStringBuffer aBufferOld;
+ OStringBuffer aBuffer = XclXmlUtils::ToOString(aBufferOld, mrFormatEntry.GetValidSrcPos());
+ OString aTextTopCell = aBuffer.makeStringAndClear();
+ OString aFormula = "NOT(ISERROR(SEARCH(\"" + aText + "\"," + aTextTopCell + ")))";
+ rWorksheet->startElement( XML_formula, FSEND );
+ rWorksheet->writeEscaped(aFormula.getStr());
+ rWorksheet->endElement( XML_formula );
+ }
// OOXTODO: XML_extLst
rWorksheet->endElement( XML_cfRule );
}
More information about the Libreoffice-commits
mailing list