formula/source/core/api/FormulaCompiler.cxx |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit 15108625d015eaeaa144d283368919ba1f6b46a8
Author:     Karthik Godha <[email protected]>
AuthorDate: Mon Feb 16 08:45:44 2026 +0530
Commit:     Karthik Godha <[email protected]>
CommitDate: Sun Mar 1 04:39:58 2026 +0100

    sc: Invalid external refs in conditional formatting
    
    Use "#REF!" for invalid external refs in formulas. The bug-file contains
    invalid external ref in it's conditional formatting.
    
    bug-document: forum-mso-en4-335846.xls
    Change-Id: I19f179e0b4cff8ca6db3de8678e01d287fbbe61b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199444
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit b58f026ebd91a9eda62cccb188b559bd4f2d70cf)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200408

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 1111f1dee6af..0470ab046d5b 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -2520,14 +2520,19 @@ void FormulaCompiler::CreateStringFromTokenArray( 
OUStringBuffer& rBuffer )
     while( t )
     {
         // Discard writing unknown functions without a name in OOXML ex: 
#NAME!()
-        if (FormulaGrammar::isOOXML(meGrammar)
-            && (t->GetOpCode() == ocNoName || t->GetOpCode() == ocExternal)
+        if (FormulaGrammar::isOOXML(meGrammar) && t->GetOpCode() == ocNoName
             && t->GetType() == svByte)
         {
             rBuffer.setLength(0);
             rBuffer.append(GetNativeSymbol(ocErrRef));
             break;
         }
+        if (t->GetOpCode() == ocExternal && t->GetType() == svByte)
+        {
+            rBuffer.append(GetNativeSymbol(ocErrRef));
+            continue;
+        }
+
         t = CreateStringFromToken(rBuffer, t, true);
     }
 

Reply via email to