From e77596be879c25f5766b73a2f67cf0ddf7775ccc Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sat, 14 Jul 2018 15:16:46 +0200 Subject: 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 --- sc/source/filter/excel/xecontent.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sc/source') 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 ); } -- cgit