summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-01-06 17:16:25 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2017-01-08 23:25:32 +0000
commit7f3e71d2a6e34e33d04739bdf48ea3c18beef1be (patch)
tree0f0b11bbe3b299be1b39eb869b57d2aaef446478
parent11913e7f3d9ee9e90e6131f67584bb60f67aa577 (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>
-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 5c8a4f1e9b50..4670aed7b050 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1404,11 +1404,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);
+ }
}
}
}