formula/source/core/api/FormulaCompiler.cxx |   22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

New commits:
commit dd929408a45379d743d72cf18a2e447956555b4c
Author:     Karthik Godha <[email protected]>
AuthorDate: Tue Jan 27 11:44:20 2026 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Tue Jan 27 14:42:15 2026 +0100

    XLSX: Discard unknown functions without names
    
    bug-document: forum-mso-de-36050.xls
    Change-Id: I62f24b888cf8c2d2e0592253c1ae431631493956
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198172
    Reviewed-by: Michael Stahl <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/formula/source/core/api/FormulaCompiler.cxx 
b/formula/source/core/api/FormulaCompiler.cxx
index 4be78a4a47bd..f2bf1d709094 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -2522,27 +2522,13 @@ void FormulaCompiler::CreateStringFromTokenArray( 
OUStringBuffer& rBuffer )
     const FormulaToken* t = maArrIterator.First();
     while( t )
     {
-        // Skip writing unknown functions without a name in OOXML ex: #NAME!()
+        // Discard writing unknown functions without a name in OOXML ex: 
#NAME!()
         if (t->GetOpCode() == ocNoName && t->GetType() == svByte
             && FormulaGrammar::isOOXML(meGrammar))
         {
-            t = maArrIterator.Next();
-            sal_uInt16 nParenthesis = 0;
-            // traverse the array to match parentheses
-            if (t && t->GetOpCode() == ocOpen)
-            {
-                do
-                {
-                    if (t->GetOpCode() == ocOpen)
-                        nParenthesis++;
-                    else if (t->GetOpCode() == ocClose)
-                        nParenthesis--;
-
-                    t = maArrIterator.Next();
-
-                } while (nParenthesis > 0 && t);
-            }
-            continue;
+            rBuffer.setLength(0);
+            rBuffer.append(GetNativeSymbol(ocErrRef));
+            break;
         }
         t = CreateStringFromToken(rBuffer, t, true);
     }

Reply via email to