sc/source/filter/excel/xeformula.cxx | 4 +++- sc/source/filter/excel/xename.cxx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
New commits: commit ac9de05cc79e76392891c18814e8f120178ccf38 Author: László Németh <[email protected]> AuthorDate: Mon May 9 14:30:59 2022 +0200 Commit: László Németh <[email protected]> CommitDate: Mon May 9 19:01:28 2022 +0200 tdf#148993 XLS export: fix broken formula regression Exported XLS documents lost their formulas opened in MSO. Regression from commit 12ee423c7549ddd2b86dfc3fc6fed2c617dcca7f "tdf#144397 tdf#144636 XLSX: cache external named ranges and their formulas". Change-Id: I009630a41b29bb21349711cc07d0ed181f816374 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134075 Tested-by: László Németh <[email protected]> Reviewed-by: László Németh <[email protected]> diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index 9b318ff3726b..e6eabd69c3d5 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -611,7 +611,9 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokA // token array iterator (use cloned token array if present) mxData->maTokArrIt.Init( mxData->mxOwnScTokArr ? *mxData->mxOwnScTokArr : rScTokArr, false ); mxData->mpRefLog = pRefLog; - mxData->mpScBasePos = pScBasePos; + // Only for OOXML + if (GetOutput() == EXC_OUTPUT_XML_2007) + mxData->mpScBasePos = pScBasePos; } } diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 513daf2795f0..4bf336a16d09 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -648,7 +648,9 @@ sal_uInt16 XclExpNameManagerImpl::CreateName( SCTAB nTab, const ScRangeData& rRa } else { - xTokArr = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_NAME, *pScTokArr, &rRangeData.GetPos() ); + bool bOOXML = GetOutput() == EXC_OUTPUT_XML_2007; + xTokArr = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_NAME, *pScTokArr, bOOXML ? + &rRangeData.GetPos() : nullptr ); sSymbol = rRangeData.GetSymbol( (GetOutput() == EXC_OUTPUT_BINARY) ? formula::FormulaGrammar::GRAM_ENGLISH_XL_A1 : formula::FormulaGrammar::GRAM_OOXML); }
