summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-01-06 18:28:42 +0100
committerEike Rathke <erack@redhat.com>2017-01-06 18:29:16 +0100
commit75d963bc7bb87429f304d29138c27178880c039a (patch)
tree0461fe5c8cb61aad3565960396da8836c51e8023 /sc
parent4fcbe16959c839bfacf745cfa554b234e639f794 (diff)
recognize the broken "Err:xxx" written by 5.2 and earlier, tdf#105024 related
... and handle same as "#ERRxxx!" if present. Change-Id: I1ebb31d628b080c52b450a8fe624c20e9e1188b7
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx21
1 files changed, 16 insertions, 5 deletions
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 3b38ac44d3c4..8fd7edae9d15 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1357,11 +1357,22 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
}
else
{
- OUString aFormulaNmsp = maFormula->second;
- if( eGrammar != formula::FormulaGrammar::GRAM_EXTERNAL )
- aFormulaNmsp.clear();
- pCode->AssignXMLString( aText, aFormulaNmsp );
- rDoc.getDoc().IncXMLImportedFormulaCount( aText.getLength() );
+ // 5.2 and earlier wrote broken "Err:xxx" as formula to designate
+ // an error formula cell.
+ if (aText.startsWithIgnoreAsciiCase("Err:") && aText.getLength() <= 9 &&
+ ((nError =
+ GetScImport().GetFormulaErrorConstant( "#ERR" + aText.copy(4) + "!")) != FormulaError::NONE))
+ {
+ pCode->SetCodeError(nError);
+ }
+ else
+ {
+ OUString aFormulaNmsp = maFormula->second;
+ if( eGrammar != formula::FormulaGrammar::GRAM_EXTERNAL )
+ aFormulaNmsp.clear();
+ pCode->AssignXMLString( aText, aFormulaNmsp );
+ rDoc.getDoc().IncXMLImportedFormulaCount( aText.getLength() );
+ }
}
ScFormulaCell* pNewCell = new ScFormulaCell(pDoc, rCellPos, pCode, eGrammar, MM_NONE);