sc/source/filter/oox/sheetdatacontext.cxx |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

New commits:
commit 9d80c4ee2a9b368236107375511b1880692ef5f2
Author:     Markus Mohrhard <markus.mohrh...@googlemail.com>
AuthorDate: Sat Jul 19 16:16:07 2025 +0800
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Aug 7 16:58:07 2025 +0200

    tdf#122336: handle OOXML files with invalid cell refs better
    
    Change-Id: Ib1e95ea0254f04852eb4c1ac4f95a587a68a9b10
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188059
    Tested-by: Jenkins
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>
    (cherry picked from commit 2c171226eeac51c6082734dc854e9c045a963f04)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188696
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/source/filter/oox/sheetdatacontext.cxx 
b/sc/source/filter/oox/sheetdatacontext.cxx
index b90f1fc5eb52..920f64dd6149 100644
--- a/sc/source/filter/oox/sheetdatacontext.cxx
+++ b/sc/source/filter/oox/sheetdatacontext.cxx
@@ -322,22 +322,24 @@ void SheetDataContext::importRow( const AttributeList& 
rAttribs )
 
 bool SheetDataContext::importCell( const AttributeList& rAttribs )
 {
-    bool bValid = true;
+    bool bValid = false;
     std::string_view p = rAttribs.getView(XML_r);
 
-    if (p.empty())
+    if (!p.empty())
+    {
+        bValid = mrAddressConv.convertToCellAddress(maCellData.maCellAddr, 
OUString::fromUtf8(p),
+                                                    mnSheet, true);
+        if (bValid)
+            mnCol = maCellData.maCellAddr.Col();
+    }
+
+    if (!bValid)
     {
         ++mnCol;
         ScAddress aAddress( mnCol, mnRow, mnSheet );
         bValid = mrAddressConv.checkCellAddress( aAddress, true );
         maCellData.maCellAddr = aAddress;
     }
-    else
-    {
-        bValid = mrAddressConv.convertToCellAddress(maCellData.maCellAddr, 
OUString::fromUtf8(p),
-                                                    mnSheet, true);
-        mnCol = maCellData.maCellAddr.Col();
-    }
 
     if( bValid )
     {

Reply via email to