sw/qa/extras/ooxmlexport/data/tdf149200.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 15 +++++++++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-)
New commits: commit e4e03e79fac598a9fafb0da8ab50da9a67c6978e Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Wed May 25 17:15:53 2022 +0300 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Mon May 30 11:52:44 2022 +0200 tdf#149200: docx export: transparent color fix If there is no color value we should not also try to write transparency information: otherwise w:srgbClr will have no parameter value and MS Word won't open such documents. Change-Id: Id67f174c5ae9aadf90ae54c126aef9a43ff3ba17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134945 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/sw/qa/extras/ooxmlexport/data/tdf149200.docx b/sw/qa/extras/ooxmlexport/data/tdf149200.docx new file mode 100644 index 000000000000..811f594b64f4 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf149200.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index da72f770151b..67f3c838e759 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -949,6 +949,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf148132, "tdf148132.docx") } } +CPPUNIT_TEST_FIXTURE(Test, testTdf149200) +{ + loadAndSave("tdf149200.docx"); + CPPUNIT_ASSERT_EQUAL(1, getPages()); + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + + // Ensure there is no unexpected invalid structure <w14:textFill> + // There is just one run property + xmlXPathObjectPtr pXmlObj = getXPathNode(pXmlDoc, "count(/w:document/w:body/w:p[1]/w:r[1]/w:rPr/*)"); + CPPUNIT_ASSERT(pXmlObj); + CPPUNIT_ASSERT_EQUAL(double(1), pXmlObj->floatval); + // And it is a color definition with themeColor + CPPUNIT_ASSERT_EQUAL(OUString("dark1"), getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w:color", "themeColor")); +} + DECLARE_OOXMLEXPORT_TEST(testTdf135923, "tdf135923-min.docx") { uno::Reference<text::XText> xShape(getShape(1), uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index f6f542ad4b39..769f120e97a8 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3184,7 +3184,7 @@ void DocxAttributeOutput::WriteCollectedRunProperties() { const char* pVal = nullptr; m_pColorAttrList->getAsChar(FSNS(XML_w, XML_val), pVal); - if (pVal == nullptr || std::string_view("auto") != pVal) + if (pVal != nullptr && std::string_view("auto") != pVal) { m_pSerializer->startElementNS(XML_w14, XML_textFill); m_pSerializer->startElementNS(XML_w14, XML_solidFill);