sc/source/ui/docshell/impex.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
New commits: commit 74e3b4e3f00b131905ad5722acadd6bbe19a81ee Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Tue May 23 10:49:55 2023 +0200 Commit: Balazs Varga <balazs.varga.ext...@allotropia.de> CommitDate: Tue May 23 12:56:43 2023 +0200 Resolves: tdf#114878 Add 'Evaluate formulas' option to CSV import and paste Backporting only the optimization from this commit. (Do not Evaluate formulas yet) cherry-pick from commit: 4c29c2bfab18b25229e0bc71014fd2ca42ec5bff (Resolves: tdf#114878 Add 'Evaluate formulas' option to CSV import and paste) Change-Id: I0200dc3fd4cb74dca4781d0a5265d3ca768657df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152143 Reviewed-by: Gabor Kelemen <kelem...@ubuntu.com> Tested-by: Gabor Kelemen <kelem...@ubuntu.com> diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 14ada5cbffb1..51e704b55a00 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1033,11 +1033,14 @@ static bool lcl_PutString( return false; } - if ( nColFormat == SC_COL_TEXT ) + // Resolves: tdf#114878 Add 'Evaluate formulas' option to CSV import and paste + // Only the optimization is backported from the tdf#114878 fix + const bool bForceFormulaText = (rStr[0] == '='); + if ( nColFormat == SC_COL_TEXT || bForceFormulaText ) { double fDummy; sal_uInt32 nIndex = 0; - if (pFormatter->IsNumberFormat(rStr, nIndex, fDummy)) + if (bForceFormulaText || pFormatter->IsNumberFormat(rStr, nIndex, fDummy)) { // Set the format of this cell to Text. sal_uInt32 nFormat = pFormatter->GetStandardFormat(SvNumFormatType::TEXT);