summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-01-06 17:16:25 +0100
committerAndras Timar <andras.timar@collabora.com>2017-02-08 11:56:05 +0100
commit938016c22dadf01a8dbfffe5a1d32bf9e4e45024 (patch)
tree11e7ff5b6ccc3756d2e2b39ecc9aefcd55b6c734 /sc
parent1d82d6e3e05801257f7f35fe06cc78f3dc8406f9 (diff)
display error constants written by 5.3+ in the for 5.2 usual way, tdf#105024
Change-Id: I5b61ed58144ae1583d74056389478e9d5c86d2cb Reviewed-on: https://gerrit.libreoffice.org/32794 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> (cherry picked from commit 7f3e71d2a6e34e33d04739bdf48ea3c18beef1be)
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx19
1 files changed, 17 insertions, 2 deletions
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 111af4435d09..383f50113c74 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1405,11 +1405,26 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
sal_uInt32 nEnglish = pFormatter->GetStandardIndex(LANGUAGE_ENGLISH_US);
double fVal;
if ( pFormatter->IsNumberFormat( aText, nEnglish, fVal ) )
+ {
rDoc.setNumericCell(rCellPos, fVal);
- //the (english) number format will not be set
- //search matching local format and apply it
+ //the (english) number format will not be set
+ //search matching local format and apply it
+ }
else
+ {
+ // Error constants are stored as "#ERRxxx!" by 5.3+, error
+ // numbers are sal_uInt16 so at most 5 decimal digits, no
+ // other expression must be present.
+ if (aText.startsWithIgnoreAsciiCase("#ERR") && aText.getLength() <= 10 &&
+ aText[aText.getLength()-1] == '!')
+ {
+ // Display error constants written by 5.3+ in the for 5.2 usual way.
+ sal_uInt32 nErr = aText.copy( 4, aText.getLength() - 5).toUInt32();
+ if (0 < nErr && nErr <= SAL_MAX_UINT16)
+ aText = ScGlobal::GetErrorString(nErr);
+ }
rDoc.setStringCell(rCellPos, aText);
+ }
}
}
}