sc/source/core/data/dpcache.cxx | 3 +- sc/source/filter/excel/xestream.cxx | 7 +++++- sc/source/filter/excel/xetable.cxx | 38 +++++++++++++++++++++++++++++++++--- sc/source/filter/inc/xestream.hxx | 2 + 4 files changed, 45 insertions(+), 5 deletions(-)
New commits: commit b1d9ef708d83573826d62fd8130525d1a5ecd5ed Author: Karthik Godha <[email protected]> AuthorDate: Wed Jan 28 20:31:27 2026 +0530 Commit: Karthik Godha <[email protected]> CommitDate: Mon Feb 16 01:15:33 2026 +0100 sc: Export TIME cell formats as DATE type in PivotTable In PivotCacheDefinition TIME cell formats are exported as Numerics, along side with `fieldGroup` element. `fieldGroup` can only be associated with DATE/TIME cells not Numerics. bug-document: forum-mso-de-38288.xls Change-Id: I677fedcd4d50ed5bea3aaf7a2a9d99d2ae0407e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198319 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 4dc8ff5919adb540c2ffa0e2ea30f785fc003dc8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199430 Tested-by: Jenkins Reviewed-by: Karthik Godha <[email protected]> diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index 1a1afb4a856b..7c9b0f4d9566 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -1068,7 +1068,8 @@ bool ScDPCache::IsDateDimension( tools::Long nDim ) const ScInterpreterContext& rContext = mrDoc.GetNonThreadedContext(); SvNumFormatType eType = rContext.NFGetType(maFields[nDim]->mnNumFormat); - return (eType == SvNumFormatType::DATE) || (eType == SvNumFormatType::DATETIME); + return (eType == SvNumFormatType::DATE) || (eType == SvNumFormatType::DATETIME) + || (eType == SvNumFormatType::TIME); } tools::Long ScDPCache::GetDimMemberCount(tools::Long nDim) const commit f133be32071a6354c8ce9ac752198875fe97de28 Author: Karthik Godha <[email protected]> AuthorDate: Tue Jan 13 21:17:30 2026 +0530 Commit: Karthik Godha <[email protected]> CommitDate: Mon Feb 16 01:15:18 2026 +0100 XLS -> XLSX: Skip writing macros in formulas During XLS import, formulas containing named references which are not in ScRangeList are imported as macros. These are not handled during XLSX export. bug document: forum-en-1357.xls Change-Id: I6584117c4956ca1e0166bb0a15b19cee404154b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197200 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> (cherry picked from commit 973d218475a071407cf3593ef9ab6243bc9c595c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199418 Reviewed-by: Karthik Godha <[email protected]> Tested-by: Jenkins diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 2121a29132ed..a0aea0032b00 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -820,7 +820,12 @@ OUString XclXmlUtils::ToOUString( else { if (nErrCode != FormulaError::NONE) - aCompiler.AppendErrorConstant( aBuffer, nErrCode); + { + if (nErrCode == FormulaError::NoMacro) + aCompiler.AppendErrorConstant(aBuffer, FormulaError::NoRef); + else + aCompiler.AppendErrorConstant(aBuffer, nErrCode); + } else { // No code SHOULD be an "error cell", assert caller thought of that diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 6bfbfa565718..f68ab40ee1b4 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -1015,15 +1015,47 @@ void XclExpFormulaCell::SaveXml( XclExpXmlStream& rStrm ) if (bWriteFormula) { + ScTokenArray aTokenArray(*mrScFmlaCell.GetCode()); + // If XLSX export then remove macro tokens from the array + if (!rStrm.IsExportVBA()) + { + formula::FormulaTokenArrayPlainIterator aIter(aTokenArray); + formula::FormulaToken* t = aIter.First(); + while (t) + { + if (t->GetOpCode() == ocMacro) + { + sal_uInt16 nStart = aIter.GetIndex() - 1; + formula::FormulaToken* pNext = aIter.PeekNext(); + if (pNext && pNext->GetOpCode() == ocOpen) + { + sal_uInt16 nParenthesis = 0; + do + { + if (pNext->GetOpCode() == ocOpen) + nParenthesis++; + else if (pNext->GetOpCode() == ocClose) + nParenthesis--; + + aIter.Next(); + pNext = aIter.PeekNext(); + } while (nParenthesis > 0 && pNext); + } + aTokenArray.RemoveToken(nStart, aIter.GetIndex() - nStart); + aIter.AfterRemoveToken(nStart, aIter.GetIndex() - nStart); + } + t = aIter.Next(); + } + } if (!bTagStarted) { rWorksheet->startElement( XML_f, XML_aca, ToPsz( (mxTokArr && mxTokArr->IsVolatile()) || (mxAddRec && mxAddRec->IsVolatile()) ) ); } - rWorksheet->writeEscaped( XclXmlUtils::ToOUString( - rStrm.GetRoot().GetCompileFormulaContext(), mrScFmlaCell.aPos, mrScFmlaCell.GetCode(), - mrScFmlaCell.GetErrCode())); + rWorksheet->writeEscaped(XclXmlUtils::ToOUString(rStrm.GetRoot().GetCompileFormulaContext(), + mrScFmlaCell.aPos, &aTokenArray, + mrScFmlaCell.GetErrCode())); rWorksheet->endElement( XML_f ); } diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx index e4ddf99e1faa..daab0f76f32b 100644 --- a/sc/source/filter/inc/xestream.hxx +++ b/sc/source/filter/inc/xestream.hxx @@ -291,6 +291,8 @@ public: /** Returns the filter root data. */ const XclExpRoot& GetRoot() const { return *mpRoot; } + bool IsExportVBA() const { return mbExportVBA; } + sax_fastparser::FSHelperPtr& GetCurrentStream(); void PushStream( sax_fastparser::FSHelperPtr const & aStream ); void PopStream();
