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

New commits:
commit 7d7371ba169aa1a59c39cadde7b4123cd6a2ca91
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Oct 27 19:53:34 2025 +0200
Commit:     Miklos Vajna <[email protected]>
CommitDate: Fri Oct 31 10:56:46 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]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193241

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index adb4dc9aa819..df80ef3581f4 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1610,6 +1610,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);
 
@@ -1657,9 +1667,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