sw/source/filter/ww8/docxattributeoutput.cxx |   39 +++++++++++++--------------
 sw/source/filter/ww8/docxexport.cxx          |    4 +-
 2 files changed, 21 insertions(+), 22 deletions(-)

New commits:
commit 382b385606779a8b4e247c5b5d61e63bb2657b50
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Oct 28 18:05:56 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Oct 31 10:56:08 2025 +0100

    mso-test: emit w:ulTrailSpace in correct order in settings.xml
    
    When loading and then saving the document from forum-mso-en3-23097.docx,
    we end up with incorrect ordering of w:ulTrailSpace under w:compat in 
settings.xml
    
    Change-Id: I5af994c2c83842883ab9fd71005633e3d1236d3b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193109
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit 430664da40b99effa241470df239b8c52a0a3c94)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193239
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index d201a872eab8..58b50c3eee0f 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -1073,6 +1073,8 @@ WriteCompat(SwDoc const& rDoc, 
::sax_fastparser::FSHelperPtr const& rpFS) -> voi
     {
         rpFS->singleElementNS(XML_w, XML_noLeading);
     }
+    if (rIDSA.get(DocumentSettingId::MS_WORD_UL_TRAIL_SPACE))
+        rpFS->singleElementNS(XML_w, XML_ulTrailSpace);
     // Do not justify lines with manual break
     if (rIDSA.get(DocumentSettingId::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK))
     {
@@ -1092,8 +1094,6 @@ WriteCompat(SwDoc const& rDoc, 
::sax_fastparser::FSHelperPtr const& rpFS) -> voi
         // Map the DoNotBreakWrappedTables compat flag to 
<w:doNotBreakWrappedTables>.
         rpFS->singleElementNS(XML_w, XML_doNotBreakWrappedTables);
     }
-    if (rIDSA.get(DocumentSettingId::MS_WORD_UL_TRAIL_SPACE))
-        rpFS->singleElementNS(XML_w, XML_ulTrailSpace);
 
     if (rIDSA.get(DocumentSettingId::ADJUST_TABLE_LINE_HEIGHTS_TO_GRID_HEIGHT))
     {
commit 641b235225f492cbb6cd02304d777e9172676422
Author:     Noel Grandin <[email protected]>
AuthorDate: Tue Oct 28 15:36:15 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Fri Oct 31 10:55:59 2025 +0100

    mso-test: emit w:numFmt in correct order in numbering xml
    
    officeotron says:
    
      INFO - Validating part "/word/numbering.xml" using schema 
"29500T/wml.xsd" ...
      ERROR      - (numbering.xml:2 col:536) cvc-complex-type.2.4.a:
                  Invalid content was found starting with element 'w:numFmt'. 
One of '{
    
    when loading and then saving the forum-mso-en4-401306.docx document.
    
    Change-Id: I2c07b360169180fb8dcbf6a932df8e9e3de4158e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193093
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit ffd2c88ddedd28896cf546f3bb06a2a59253f25e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193238
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 56c0373e868b..63d6110069c7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7824,6 +7824,15 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 
nLevel,
                 FSNS( XML_w, XML_val ), OString::number(nStart) );
     }
 
+    // format
+    OString aCustomFormat;
+    OString aFormat(lcl_ConvertNumberingType(nNumberingType, pOutSet, 
aCustomFormat, "decimal"_ostr));
+
+    if (aCustomFormat.isEmpty())
+    {
+        m_pSerializer->singleElementNS(XML_w, XML_numFmt, FSNS(XML_w, 
XML_val), aFormat);
+    }
+
     if (m_bExportingOutline)
     {
         sal_uInt16 nId = m_rExport.m_pStyles->GetHeadingParagraphStyleId( 
nLevel );
@@ -7835,29 +7844,19 @@ void DocxAttributeOutput::NumberingLevel( sal_uInt8 
nLevel,
     if (isLegal)
         m_pSerializer->singleElementNS(XML_w, XML_isLgl);
 
-    // format
-    OString aCustomFormat;
-    OString aFormat(lcl_ConvertNumberingType(nNumberingType, pOutSet, 
aCustomFormat, "decimal"_ostr));
-
+    if (!aCustomFormat.isEmpty())
     {
-        if (aCustomFormat.isEmpty())
-        {
-            m_pSerializer->singleElementNS(XML_w, XML_numFmt, FSNS(XML_w, 
XML_val), aFormat);
-        }
-        else
-        {
-            m_pSerializer->startElementNS(XML_mc, XML_AlternateContent);
-            m_pSerializer->startElementNS(XML_mc, XML_Choice, XML_Requires, 
"w14");
+        m_pSerializer->startElementNS(XML_mc, XML_AlternateContent);
+        m_pSerializer->startElementNS(XML_mc, XML_Choice, XML_Requires, "w14");
 
-            m_pSerializer->singleElementNS(XML_w, XML_numFmt, FSNS(XML_w, 
XML_val), aFormat,
-                                           FSNS(XML_w, XML_format), 
aCustomFormat);
+        m_pSerializer->singleElementNS(XML_w, XML_numFmt, FSNS(XML_w, 
XML_val), aFormat,
+                                       FSNS(XML_w, XML_format), aCustomFormat);
 
-            m_pSerializer->endElementNS(XML_mc, XML_Choice);
-            m_pSerializer->startElementNS(XML_mc, XML_Fallback);
-            m_pSerializer->singleElementNS(XML_w, XML_numFmt, FSNS(XML_w, 
XML_val), "decimal");
-            m_pSerializer->endElementNS(XML_mc, XML_Fallback);
-            m_pSerializer->endElementNS(XML_mc, XML_AlternateContent);
-        }
+        m_pSerializer->endElementNS(XML_mc, XML_Choice);
+        m_pSerializer->startElementNS(XML_mc, XML_Fallback);
+        m_pSerializer->singleElementNS(XML_w, XML_numFmt, FSNS(XML_w, 
XML_val), "decimal");
+        m_pSerializer->endElementNS(XML_mc, XML_Fallback);
+        m_pSerializer->endElementNS(XML_mc, XML_AlternateContent);
     }
 
     // suffix

Reply via email to