sc/source/core/data/documen3.cxx |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

New commits:
commit 5c916f08714bde7f10c88869b8e9e8da89caaa9c
Author:     Karthik Godha <[email protected]>
AuthorDate: Fri Feb 20 15:56:39 2026 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Feb 20 14:37:16 2026 +0100

    XLS: Import unknown external references
    
    For older XLS files, only the external references which contain their
    source file in the systerm are getting imported.
    Import all external references even if the source file is not present
    in the system.
    
    bug-document: forum-mso-en4-366513.xls
    Change-Id: I33c919f1a8f5bd4cbf621fc3fd8ccb7105429f16
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199817
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index ade786e0a829..d0bba63ca0fd 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -611,25 +611,22 @@ bool ScDocument::LinkExternalTab( SCTAB& rTab, const 
OUString& aDocTab,
     OUString  aOptions; // Filter options
     sal_uInt32 nLinkCnt = pExtDocOptions ? 
pExtDocOptions->GetDocSettings().mnLinkCnt : 0;
     ScDocumentLoader aLoader( aFileName, aFilterName, aOptions, nLinkCnt + 1 );
-    if ( aLoader.IsError() )
+    ScDocument* pSrcDoc = aLoader.IsError() ? nullptr : aLoader.GetDocument();
+
+    if (!InsertTab(SC_TAB_APPEND, aDocTab, true))
+    {
+        OSL_FAIL("can't insert external document table");
         return false;
-    ScDocument* pSrcDoc = aLoader.GetDocument();
+    }
+    rTab = GetTableCount() - 1;
 
     // Copy table
     SCTAB nSrcTab;
-    if ( pSrcDoc->GetTable( aTabName, nSrcTab ) )
+    if (pSrcDoc && pSrcDoc->GetTable(aTabName, nSrcTab))
     {
-        if ( !InsertTab( SC_TAB_APPEND, aDocTab, true ) )
-        {
-            OSL_FAIL("can't insert external document table");
-            return false;
-        }
-        rTab = GetTableCount() - 1;
         // Don't insert anew, just the results
         TransferTab( *pSrcDoc, nSrcTab, rTab, false, true );
     }
-    else
-        return false;
 
     sal_Int32 nRefreshDelay = 0;
 

Reply via email to