summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/column3.cxx22
1 files changed, 17 insertions, 5 deletions
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 36e20ef23aff..795f0fe34c15 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2070,11 +2070,23 @@ bool ScColumn::ParseString(
if (!bIsNumberFormat)
break;
- // convert back to the original language if a built-in format was detected
- if (!pOldFormat)
- pOldFormat = aParam.mpNumFormatter->GetEntry( nOldIndex );
- if ( pOldFormat )
- nIndex = aParam.mpNumFormatter->GetFormatForLanguageIfBuiltIn( nIndex, pOldFormat->GetLanguage() );
+ // If we have bForceFormatDate, the pOldFormat was/is of
+ // nOldIndex date(+time) type already, if detected type is
+ // compatible keep the original format.
+ if (bForceFormatDate && SvNumberFormatter::IsCompatible(
+ eNumFormatType, aParam.mpNumFormatter->GetType( nIndex)))
+ {
+ nIndex = nOldIndex;
+ }
+ else
+ {
+ // convert back to the original language if a built-in format was detected
+ if (!pOldFormat)
+ pOldFormat = aParam.mpNumFormatter->GetEntry( nOldIndex );
+ if (pOldFormat)
+ nIndex = aParam.mpNumFormatter->GetFormatForLanguageIfBuiltIn(
+ nIndex, pOldFormat->GetLanguage());
+ }
rCell.set(nVal);
if ( nIndex != nOldIndex)