summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2020-05-05 18:31:17 +0200
committerEike Rathke <erack@redhat.com>2020-05-05 21:33:47 +0200
commitb7a53077fd592c514d2f255cc19e4f0deb483dca (patch)
tree7d49445c10db15dbab86b5e4e4414b1e985badef /sc
parente21bc1b3e587c2bd90168b24f3774d98a3837f8e (diff)
Resolves: tdf#131536 TEXT() support empty format string mimicking Excel
Change-Id: Iffc37179cafb8b8bcfa1232e7aa54ae119ab5846 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93504 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr1.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 839c5135d665..644783757893 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -9562,6 +9562,18 @@ void ScInterpreter::ScText()
}
if (nGlobalError != FormulaError::NONE)
PushError( nGlobalError);
+ else if (sFormatString.isEmpty())
+ {
+ // Mimic the Excel behaviour that
+ // * anything numeric returns an empty string
+ // * text convertible to numeric returns an empty string
+ // * any other text returns that text
+ // Conversion was detected above.
+ if (bString)
+ PushString( aStr);
+ else
+ PushString( OUString());
+ }
else
{
OUString aResult;