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 de0312e81c86d3a9a1fdf1e4be4df32e2a4c6546 Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Wed May 25 17:15:53 2022 +0300 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon May 30 13:14:41 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> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135121 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 7915ade87d6d..90b923d0a612 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -393,6 +393,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(testTdf148273_sectionBulletFormatLeak, "tdf148273_sectionBulletFormatLeak.docx") { // get a paragraph with bullet point after section break diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index a6da6244898a..f31342d3074d 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3064,7 +3064,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);