sc/source/filter/xcl97/xcl97rec.cxx |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 986c035375f74103a0c2c7160cb4d4678406f115
Author:     Ujjawal Kumar <[email protected]>
AuthorDate: Wed Feb 25 18:11:18 2026 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Wed Feb 25 16:21:05 2026 +0100

    ooxml: Avoid writing xdr:twoCellAnchor when no graphic exists
    
    Bug document: fdo84640-1.xls
    
    The above document contains anchored graphics elements on sheet2 with
    no actual graphic in it and when exported to xlsx the xdr:twoCellAnchor gets
    exported with no graphic inside it and excel throws an recovery error.
    
    Change-Id: I8072351b4ef3c016b39fbca81cb0c5439108d95f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200325
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sc/source/filter/xcl97/xcl97rec.cxx 
b/sc/source/filter/xcl97/xcl97rec.cxx
index 94a25cd60ad2..fbd00455271b 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -25,6 +25,7 @@
 #include <sot/storage.hxx>
 #include <svl/itemset.hxx>
 #include <svx/svdocapt.hxx>
+#include <svx/svdograf.hxx>
 #include <svx/unoapi.hxx>
 #include <editeng/writingmodeitem.hxx>
 #include <tools/urlobj.hxx>
@@ -1318,6 +1319,13 @@ void XclObjAny::SaveXml( XclExpXmlStream& rStrm )
     SdrObject* pObject = SdrObject::getSdrObjectFromXShape(mxShape);
     if (pObject)
     {
+        if (pObject->GetObjIdentifier() == SdrObjKind::Graphic)
+        {
+            auto pGrafObj = dynamic_cast<const SdrGrafObj*>(pObject);
+            if (pGrafObj && pGrafObj->GetGraphic().GetType() == 
GraphicType::NONE)
+                return;
+        }
+
         ScDocument& rDoc = rStrm.GetRoot().GetDoc();
         ScDetectiveFunc aDetFunc(rDoc, mnScTab);
         ScAddress       aPosition;

Reply via email to