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

New commits:
commit 249d718a90f4832e081d31534ae1da9435ec5d20
Author:     Noel Grandin <[email protected]>
AuthorDate: Mon Oct 27 13:44:59 2025 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Tue Jan 13 10:26:42 2026 +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 402782f02560..e76d08bb35d7 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1567,6 +1567,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)
@@ -1576,12 +1577,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