sc/inc/global.hxx               |    2 ++
 sc/source/core/data/dpcache.cxx |    7 ++++++-
 sc/source/core/data/global.cxx  |   17 +++++++++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit ab8adf77222d52c9880b773d694145c341b32288
Author:     Karthik Godha <[email protected]>
AuthorDate: Mon Feb 2 10:25:43 2026 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Thu Feb 12 17:38:22 2026 +0100

    XLSX: Use Excel compatible errors in PivotTable
    
    Excel doesn't support all LO internal errors, replace them with Excel
    compatible errors
    Ex: #ADDIN?
    
    bug-document: forum-mso-en3-16864.xls
    Change-Id: Id6d4f9e2d36e16f859c08a9bf2a0f96fea87d3b3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198509
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit fb138143df479e2f742ed194fdeb55606e032c77)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199249

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 2bd3d499bef7..b1d597262782 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -625,6 +625,8 @@ public:
                                             const SfxItemSet& rOldAttrs,
                                             const sal_uInt16      nWhich );
 
+    static bool IsValidOOXMLError(FormulaError nErrNumber);
+
     static ScUnitConverter* GetUnitConverter();
 
     /// strchr() functionality on unicode, as long as we need it for 
FormulaToken etc.
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 7c9b0f4d9566..6082cb71813f 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -147,7 +147,12 @@ void initFromCell(
 
     if (rCell.hasError())
     {
-        rData.SetErrorStringInterned(internString(rStrPool, 
rDoc.GetString(rPos.Col(), rPos.Row(), rPos.Tab())));
+        if (ScGlobal::IsValidOOXMLError(rCell.getFormula()->GetErrCode()))
+            rData.SetErrorStringInterned(
+                internString(rStrPool, rDoc.GetString(rPos.Col(), rPos.Row(), 
rPos.Tab())));
+        else
+            rData.SetErrorStringInterned(
+                internString(rStrPool, 
ScGlobal::GetErrorString(FormulaError::NotAvailable)));
     }
     else if (rCell.hasNumeric())
     {
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 92930c7c1a4b..10abd9bd8757 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -439,6 +439,23 @@ OUString ScGlobal::GetLongErrorString(FormulaError nErr)
     return ScResId(pErrNumber);
 }
 
+bool ScGlobal::IsValidOOXMLError(FormulaError nErrNumber)
+{
+    switch (nErrNumber)
+    {
+        case FormulaError::DivisionByZero:
+        case FormulaError::NotAvailable:
+        case FormulaError::NoName:
+        case FormulaError::NoCode:
+        case FormulaError::IllegalFPOperation:
+        case FormulaError::NoRef:
+        case FormulaError::NoValue:
+            return true;
+        default:
+            return false;
+    }
+}
+
 SvxBrushItem* ScGlobal::GetButtonBrushItem()
 {
     assert(!bThreadedGroupCalcInProgress);

Reply via email to