sc/source/filter/excel/xistyle.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
New commits: commit bea351faaf18f1c12fddc8aab13dcc840505667e Author: Karthik Godha <[email protected]> AuthorDate: Wed Jan 14 19:56:54 2026 +0530 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 14 16:22:27 2026 +0100 XLS -> XLSX: Discard overlapping merge ranges bug document: forum-en-5338.xls Change-Id: I5da6b650ae1c73606c6688210ba65f28920eeed4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197273 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index e2b9a53bb4c1..fec98767598d 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -1997,8 +1997,14 @@ void XclImpXFRangeBuffer::SetHyperlink( const XclRange& rXclRange, const OUStrin void XclImpXFRangeBuffer::SetMerge( SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2, SCROW nScRow2 ) { - if( (nScCol1 < nScCol2) || (nScRow1 < nScRow2) ) - maMergeList.push_back( ScRange( nScCol1, nScRow1, 0, nScCol2, nScRow2, 0 ) ); + if ((nScCol1 < nScCol2) || (nScRow1 < nScRow2)) + { + ScRange aRange(nScCol1, nScRow1, 0, nScCol2, nScRow2, 0); + // If merge range intersects with existing merge ranges then discard it. + if (maMergeList.Intersects(aRange)) + return; + maMergeList.push_back(aRange); + } } void XclImpXFRangeBuffer::Finalize()
