diff options
-rw-r--r-- | sc/source/core/data/documen4.cxx | 2 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 7e064ae5b673..b3bb256267a1 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -119,6 +119,8 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, { PutInOrder(nCol1, nCol2); PutInOrder(nRow1, nRow2); + nCol2 = std::min<SCCOL>(nCol2, MAXCOL); + nRow2 = std::min<SCROW>(nRow2, MAXROW); if (!rMark.GetSelectCount()) { SAL_WARN("sc", "ScDocument::InsertMatrixFormula Keine Tabelle markiert"); diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 957cb67a35ac..398a49c90996 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1063,8 +1063,8 @@ void ScXMLTableRowCellContext::AddFormulaCell( const ScAddress& rCellPos ) //value/text of each matrix cell later rXMLImport.GetTables().AddMatrixRange( rCellPos.Col(), rCellPos.Row(), - rCellPos.Col() + nMatrixCols - 1, - rCellPos.Row() + nMatrixRows - 1, + std::min<SCCOL>(rCellPos.Col() + nMatrixCols - 1, MAXCOL), + std::min<SCROW>(rCellPos.Row() + nMatrixRows - 1, MAXROW), pOUFormula->first, pOUFormula->second, eGrammar); //set the value/text of the first matrix position (top-left). |