Bugfix: Workitem 14374 - BUG : Excel5 and setReadFilter ?

Prevent creation of Merged cells unless the read filter permits one or more cells within the range

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@62384 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2010-10-18 16:55:55 +00:00
parent 58a600b3e3
commit a73633f130
1 changed files with 21 additions and 1 deletions

View File

@ -3817,6 +3817,24 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
}
}
private function _includeCellRangeFiltered($cellRangeAddress)
{
$includeCellRange = true;
if (!is_null($this->getReadFilter())) {
$includeCellRange = false;
$rangeBoundaries = PHPExcel_Cell::getRangeBoundaries($cellRangeAddress);
for ($row = $rangeBoundaries[0][1]; $row <= $rangeBoundaries[1][1]; $row++) {
for ($column = $rangeBoundaries[0][0]; $column <= $rangeBoundaries[1][0]; $column++) {
if ($this->getReadFilter()->readCell($column, $row, $this->_phpSheet->getTitle())) {
$includeCellRange = true;
break 2;
}
}
}
}
return $includeCellRange;
}
/**
* MERGEDCELLS
*
@ -3837,10 +3855,12 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
if ($this->_version == self::XLS_BIFF8 && !$this->_readDataOnly) {
$cellRangeAddressList = $this->_readBIFF8CellRangeAddressList($recordData);
foreach ($cellRangeAddressList['cellRangeAddresses'] as $cellRangeAddress) {
if ($this->_includeCellRangeFiltered($cellRangeAddress)) {
$this->_phpSheet->mergeCells($cellRangeAddress);
}
}
}
}
/**
* Read HYPERLINK record