recognize the broken "Err:xxx" written by 5.2 and earlier, tdf#105024 related
... and handle same as "#ERRxxx!" if present.
Change-Id: I1ebb31d628b080c52b450a8fe624c20e9e1188b7
(cherry picked from commit 75d963bc7bb87429f304d29138c27178880c039a)
Reviewed-on: https://gerrit.libreoffice.org/32793
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 3b38ac4..8fd7eda 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);