sw/source/filter/ww8/docxattributeoutput.cxx |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 0a534de59da32206dcd369e5e0a8b41e162a6fb1
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Oct 27 19:53:34 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Oct 30 18:29:13 2025 +0100

    mso-test: emit framePr element in correct place
    
    when loading and then saving the document from tdf#112456,
    we end up with incorrect ordering of the framePr element,
    which causes ms-office to think the document is corrupt
    
    Change-Id: Ie8de5b94c3d4e71353a5c0783b05b0df3dfe6058
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193049
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>
    (cherry picked from commit 58b7a5e4ac79d6bf0d38fe20b7571484aa24fa1e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193207
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 03f165a1cd2e..2ed1e16449be 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1608,6 +1608,16 @@ void DocxAttributeOutput::EndParagraphProperties(const 
SfxItemSet& rParagraphMar
 
     WriteCollectedParagraphProperties();
 
+    // Write w:framePr
+    if (!m_bWritingHeaderFooter && m_aFramePr.Frame())
+    {
+        const SwFrameFormat& rFrameFormat = 
m_aFramePr.Frame()->GetFrameFormat();
+        assert(SwTextBoxHelper::TextBoxIsFramePr(rFrameFormat) && "by 
definition, because Frame()");
+
+        const Size aSize = m_aFramePr.Frame()->GetSize();
+        PopulateFrameProperties(&rFrameFormat, aSize);
+    }
+
     // Merge the marks for the ordered elements
     m_pSerializer->mergeTopMarks(Tag_InitCollectedParagraphProperties);
 
@@ -1655,9 +1665,6 @@ void DocxAttributeOutput::EndParagraphProperties(const 
SfxItemSet& rParagraphMar
         const SwFrameFormat& rFrameFormat = 
m_aFramePr.Frame()->GetFrameFormat();
         assert(SwTextBoxHelper::TextBoxIsFramePr(rFrameFormat) && "by 
definition, because Frame()");
 
-        const Size aSize = m_aFramePr.Frame()->GetSize();
-        PopulateFrameProperties(&rFrameFormat, aSize);
-
         // if the paragraph itself never called FormatBox, do so now
         if (m_aFramePr.UseFrameBorders(!m_xTableWrt ? -1 : 
m_tableReference.m_nTableDepth))
             FormatBox(rFrameFormat.GetBox());

Reply via email to