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 5ee40c578c2796bb392ec5929e1f046c36a8912b Author: Karthik Godha <[email protected]> AuthorDate: Mon Feb 2 10:25:43 2026 +0530 Commit: Karthik Godha <[email protected]> CommitDate: Fri Feb 27 02:49:05 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/+/200480 Tested-by: Jenkins Reviewed-by: Karthik Godha <[email protected]> diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 3033095ac82e..4ad10ec35902 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -643,6 +643,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 cf245280a836..764c51c062ae 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -432,6 +432,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);
