sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 15 +++++---------- sw/source/filter/ww8/docxattributeoutput.cxx | 3 +++ 2 files changed, 8 insertions(+), 10 deletions(-)
New commits: commit 232b4ff3d530080efe28b8212c44952a625f8bc9 Author: Noel Grandin <[email protected]> AuthorDate: Thu Jan 15 15:06:13 2026 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Jan 19 10:47:21 2026 +0100 officeotron: moveFromRangeStart must have a w:date attribute so just give it our null date Change-Id: I22bdd9ffd53dbe7d4608a759dfc9dd93c658f44a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197426 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 9d6490d1e118..b724869b42bf 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -1209,9 +1209,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf118521_marginsLR, "tdf118521_marginsLR.docx") DECLARE_OOXMLEXPORT_TEST(testTdf104797, "tdf104797.docx") { - // FIXME: validation error in OOXML export: Errors: 2 - skipValidation(); - // check moveFrom and moveTo CPPUNIT_ASSERT_EQUAL(u"Will this sentence be duplicated?"_ustr, getParagraph(1)->getString()); CPPUNIT_ASSERT_EQUAL(u""_ustr, getRun(getParagraph(1), 1)->getString()); @@ -1250,9 +1247,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf145720) // check moveFromRangeStart/End and moveToRangeStart/End (to keep tracked text moving) createSwDoc("tdf104797.docx"); - // FIXME: validation error in OOXML export: Errors: 2 - skipValidation(); - save(TestFilter::DOCX); xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); // These were 0 (missing move*FromRange* elements) @@ -1269,10 +1263,11 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf145720) // mandatory authors and dates assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:moveFromRangeStart", "author", u"Tekijä"); assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:moveToRangeStart", "author", u"Tekijä"); - // no date (anonymized change) - // This failed, date was exported as w:date="0-00-00T00:00:00Z", and later "1970-01-01T00:00:00Z" - assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p[1]/w:moveFromRangeStart", "date"); - assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p[2]/w:moveToRangeStart", "date"); + // anonymized date + assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:moveFromRangeStart", "date", + u"1970-01-01T00:00:00Z"); + assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:moveToRangeStart", "date", + u"1970-01-01T00:00:00Z"); } CPPUNIT_TEST_FIXTURE(Test, testTdf150166) diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index df844f72b6a7..9573f086aad9 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2261,6 +2261,9 @@ void DocxAttributeOutput::DoWriteMoveRangeTagStart(std::u16string_view bookmarkN : OUStringToOString(rAuthor, RTL_TEXTENCODING_UTF8)); if (!bNoDate) pAttributeList->add(FSNS(XML_w, XML_date ), DateTimeToOString( aDateTime )); + else + // w:data is a required attribute, so just use a placeholder date + pAttributeList->add(FSNS(XML_w, XML_date ), "1970-01-01T00:00:00Z"); pAttributeList->add(FSNS(XML_w, XML_name), bookmarkName); m_pSerializer->singleElementNS( XML_w, bFrom ? XML_moveFromRangeStart : XML_moveToRangeStart, pAttributeList );
