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

New commits:
commit a8f540c06a0572560aa75427a1884d8ecf1a1f44
Author:     Karthik Godha <[email protected]>
AuthorDate: Sun Feb 8 16:15:06 2026 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Tue Feb 10 12:42:03 2026 +0100

    XLSX: "#Name!" is being exported in formulas
    
    ocNoName token of type `svExternal` or `svString` would result in
    "#name!{token_string}". In XLSX a valid formula can't contain "#name!".
    
    bug-document: forum-mso-en4-29202.xls
    Change-Id: I9dcc25f2b14948385573657c562768ff3d598d97
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198941
    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 f2bf1d709094..49d0e873596c 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -2641,6 +2641,10 @@ const FormulaToken* 
FormulaCompiler::CreateStringFromToken( OUStringBuffer& rBuf
         else
             rBuffer.append(mxSymbols->getSymbol(eOp));
     }
+    else if (eOp == ocNoName && FormulaGrammar::isOOXML(meGrammar))
+    {
+        // Don't export "#name!" in OOXML
+    }
     else if( static_cast<sal_uInt16>(eOp) < mxSymbols->getSymbolCount())       
 // Keyword:
         rBuffer.append( mxSymbols->getSymbol( eOp));
     else

Reply via email to