sw/source/filter/ww8/docxattributeoutput.cxx |    2 +-
 sw/source/filter/ww8/wrtw8sty.cxx            |    5 ++++-
 sw/source/filter/ww8/wrtww8.cxx              |    1 +
 sw/source/filter/ww8/wrtww8.hxx              |    1 +
 4 files changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 60353ecbeef97fc15cb1476d2410ce7d6582da0c
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Jan 15 11:21:32 2026 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Jan 19 12:12:11 2026 +0100

    officeotron: duplicate <w:bidi/> elements
    
    we end up with:
    
    <w:document
       ..
            <w:bidi/>
            <w:bidi/>
            <w:docGrid w:type="default" w:linePitch="360" w:charSpace="0"/>
        </w:sectPr>
      </w:body>
    </w:document>
    
    Change-Id: Ie3a8cc5f02c40b5f4df7cb2efd43b057210fd4ad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197423
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit a971b4c2ac8197e27ee30a21c02893fecb6fb989)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197531
    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 801f5a7de791..1e4168c9a330 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -10288,7 +10288,7 @@ void DocxAttributeOutput::FormatFrameDirection( const 
SvxFrameDirectionItem& rDi
     if ( m_rExport.m_bOutPageDescs )
     {
         m_pSerializer->singleElementNS(XML_w, XML_textDirection, FSNS(XML_w, 
XML_val), sTextFlow);
-        if ( bBiDi )
+        if ( bBiDi && !m_rExport.m_bSuppressBidi )
             m_pSerializer->singleElementNS(XML_w, XML_bidi);
     }
     else if ( !m_rExport.m_bOutFlyFrameAttrs )
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index 95b77175b38f..44da356057bd 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1763,14 +1763,17 @@ void MSWordExportBase::SectionProperties( const 
WW8_SepInfo& rSepInfo, WW8_PdAtt
             const SfxItemSet* pOldI = m_pISet;
             m_pISet = &aSet;
 
+            const bool bBiDi = SvxFrameDirection::Horizontal_RL_TB == 
TrueFrameDirection( *rSepInfo.pSectionFormat );
+            m_bSuppressBidi = bBiDi; // prevent duplicate <w:bidi/> elements
             // Switch off test on default item values, if page description
             // set (value of <bOutPgDscSet>) isn't written.
             AttrOutput().OutputStyleItemSet( aSet, bOutPgDscSet );
             bOutputStyleItemSet = true;
+            m_bSuppressBidi = false;
 
             //Cannot export as normal page framedir, as continuous sections
             //cannot contain any grid settings like proper sections
-            AttrOutput().SectionBiDi( SvxFrameDirection::Horizontal_RL_TB == 
TrueFrameDirection( *rSepInfo.pSectionFormat ) );
+            AttrOutput().SectionBiDi( bBiDi );
 
             m_pISet = pOldI;
         }
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 77a1a92517de..51c6322db9f4 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -3978,6 +3978,7 @@ MSWordExportBase::MSWordExportBase( SwDoc& rDocument, 
std::shared_ptr<SwUnoCurso
     , m_bHasFtr(false)
     , m_bSubstituteBullets(true)
     , m_bTabInTOC(false)
+    , m_bSuppressBidi(false)
     , m_bHideTabLeaderAndPageNumbers(false)
     , m_bExportModeRTF(false)
     , m_bFontSizeWritten(false)
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index de4787723bf8..0e8723ebfea2 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -570,6 +570,7 @@ public:
     bool m_bHasFtr : 1;
     bool m_bSubstituteBullets : 1; // true: SubstituteBullet() gets called
     bool m_bTabInTOC : 1; //true for TOC field flag 'w'
+    bool m_bSuppressBidi : 1; // prevent duplicate bidi elements
 
     bool m_bHideTabLeaderAndPageNumbers : 1 ; // true: the 'z' field of TOC is 
set.
     bool m_bExportModeRTF;

Reply via email to