sw/source/filter/ww8/docxattributeoutput.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 110d88a1e8f77a3b3c2d8ddb3f203e4858be77e6
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Oct 27 13:44:59 2025 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Oct 29 15:54:31 2025 +0100

    mso-test: fix duplicate w:i element
    
    when loading and then saving the document from tdf#99822, we end up with a 
duplicate w:i element,
    which causes ms-office to think the document is corrupt
    
    Change-Id: I6b7867fd4ee52d37502fde86a13294ef457416d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193035
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 8a44a74d09d8..444fedab3af4 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1548,6 +1548,7 @@ void 
lcl_writeParagraphMarkerProperties(DocxAttributeOutput& rAttributeOutput, c
     // Did we already produce a <w:sz> element?
     bool bFontSizeWritten = false;
     bool bBoldWritten = false;
+    bool bPostureWritten = false;
     while (nWhichId)
     {
         if (aIter.GetItemState(true, &pItem) == SfxItemState::SET)
@@ -1557,12 +1558,15 @@ void 
lcl_writeParagraphMarkerProperties(DocxAttributeOutput& rAttributeOutput, c
                 // Will this item produce a <w:sz> element?
                 bool bFontSizeItem = nWhichId == RES_CHRATR_FONTSIZE || 
nWhichId == RES_CHRATR_CJK_FONTSIZE;
                 bool bBoldItem = nWhichId == RES_CHRATR_WEIGHT || nWhichId == 
RES_CHRATR_CJK_WEIGHT;
-                if (!(bFontSizeWritten && bFontSizeItem) && !(bBoldWritten && 
bBoldItem))
+                bool bPostureItem = nWhichId == RES_CHRATR_POSTURE || nWhichId 
== RES_CHRATR_CJK_POSTURE;
+                if (!(bFontSizeWritten && bFontSizeItem) && !(bBoldWritten && 
bBoldItem) && !(bPostureWritten && bPostureItem))
                     rAttributeOutput.OutputItem(*pItem);
                 if (bFontSizeItem)
                     bFontSizeWritten = true;
                 if (bBoldItem)
                     bBoldWritten = true;
+                if (bPostureItem)
+                    bPostureWritten = true;
             }
             else if (nWhichId == RES_TXTATR_AUTOFMT)
             {

Reply via email to