mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-18 14:40:36 +00:00
Merge pull request #4919 from oleibman/nogetfilter
Readers Should Directly Access readFilter
This commit is contained in:
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). Thia is a
|
||||
|
||||
- Navigate Cell as Cursor. [Issue #863](https://github.com/PHPOffice/PhpSpreadsheet/issues/863) [PR #4909](https://github.com/PHPOffice/PhpSpreadsheet/pull/4909)
|
||||
- Chart DataTables. [Issue #413](https://github.com/PHPOffice/PhpSpreadsheet/issues/413) [PR #4911](https://github.com/PHPOffice/PhpSpreadsheet/pull/4911)
|
||||
- Permit Ignoring "Misleading Format" Tag. [PR #4914](https://github.com/PHPOffice/PhpSpreadsheet/pull/4914)
|
||||
|
||||
### Removed
|
||||
|
||||
@@ -33,6 +34,8 @@ and this project adheres to [Semantic Versioning](https://semver.org). Thia is a
|
||||
- Small improvement for Radar Charts. [Issue #661](https://github.com/PHPOffice/PhpSpreadsheet/issues/661) [PR #4908](https://github.com/PHPOffice/PhpSpreadsheet/pull/4908)
|
||||
- Allow Use of Multiple Ranges When Setting Styles. [Issue #411](https://github.com/PHPOffice/PhpSpreadsheet/issues/411) [PR #4910](https://github.com/PHPOffice/PhpSpreadsheet/pull/4910)
|
||||
- Small change to Writer Html. [Issue #434](https://github.com/PHPOffice/PhpSpreadsheet/issues/434) [PR #4912](https://github.com/PHPOffice/PhpSpreadsheet/pull/4912)
|
||||
- Avoid hard-coding some chart Xml attributes. [PR #4915](https://github.com/PHPOffice/PhpSpreadsheet/pull/4915)
|
||||
- Readers should directly access readFilter. [PR #4919](https://github.com/PHPOffice/PhpSpreadsheet/pull/4919)
|
||||
|
||||
## 2026-06-06 - 5.8.0
|
||||
|
||||
|
||||
@@ -311,7 +311,7 @@ class Gnumeric extends BaseReader
|
||||
$column = Coordinate::stringFromColumnIndex($column + 1);
|
||||
|
||||
// Read cell?
|
||||
if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) {
|
||||
if (!$this->readFilter->readCell($column, $row, $worksheetName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -851,7 +851,7 @@ class Ods extends BaseReader
|
||||
// repeated range passes the read filter. If not, skip the entire group.
|
||||
// If some columns pass, we need to fall through to the processing block
|
||||
// which will handle per-column filtering.
|
||||
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
||||
if (!$this->readFilter->readCell($columnID, $rowID, $worksheetName)) {
|
||||
if ($colRepeats <= 1) {
|
||||
StringHelper::stringIncrement($columnID);
|
||||
|
||||
@@ -865,7 +865,7 @@ class Ods extends BaseReader
|
||||
if ($i > 0) {
|
||||
StringHelper::stringIncrement($tempCol);
|
||||
}
|
||||
if ($this->getReadFilter()->readCell($tempCol, $rowID, $worksheetName)) {
|
||||
if ($this->readFilter->readCell($tempCol, $rowID, $worksheetName)) {
|
||||
$anyColumnPasses = true;
|
||||
|
||||
break;
|
||||
@@ -1143,7 +1143,7 @@ class Ods extends BaseReader
|
||||
StringHelper::stringIncrement($columnID);
|
||||
}
|
||||
|
||||
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
||||
if (!$this->readFilter->readCell($columnID, $rowID, $worksheetName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -2728,7 +2728,7 @@ class Xls extends XlsBase
|
||||
$columnString = Coordinate::stringFromColumnIndex($column + 1);
|
||||
|
||||
// Read cell?
|
||||
if ($this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
if ($this->readFilter->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
// offset: 4; size: 2; index to XF record
|
||||
$xfIndex = self::getUInt2d($recordData, 4);
|
||||
|
||||
@@ -2773,7 +2773,7 @@ class Xls extends XlsBase
|
||||
|
||||
$cell = null;
|
||||
// Read cell?
|
||||
if ($this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
if ($this->readFilter->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
// offset: 4; size: 2; index to XF record
|
||||
$xfIndex = self::getUInt2d($recordData, 4);
|
||||
|
||||
@@ -2874,7 +2874,7 @@ class Xls extends XlsBase
|
||||
$columnString = Coordinate::stringFromColumnIndex($colFirst + $i);
|
||||
|
||||
// Read cell?
|
||||
if ($this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
if ($this->readFilter->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
// offset: var; size: 2; index to XF record
|
||||
$xfIndex = self::getUInt2d($recordData, $offset);
|
||||
|
||||
@@ -2918,7 +2918,7 @@ class Xls extends XlsBase
|
||||
$columnString = Coordinate::stringFromColumnIndex($column + 1);
|
||||
|
||||
// Read cell?
|
||||
if ($this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
if ($this->readFilter->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
// offset 4; size: 2; index to XF record
|
||||
$xfIndex = self::getUInt2d($recordData, 4);
|
||||
|
||||
@@ -2984,7 +2984,7 @@ class Xls extends XlsBase
|
||||
}
|
||||
|
||||
// Read cell?
|
||||
if ($this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
if ($this->readFilter->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
if ($isPartOfSharedFormula) {
|
||||
// formula is added to this cell after the sheet has been read
|
||||
$this->sharedFormulaParts[$columnString . ($row + 1)] = $this->baseCell;
|
||||
@@ -3150,7 +3150,7 @@ class Xls extends XlsBase
|
||||
$columnString = Coordinate::stringFromColumnIndex($column + 1);
|
||||
|
||||
// Read cell?
|
||||
if ($this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
if ($this->readFilter->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
// offset: 4; size: 2; index to XF record
|
||||
$xfIndex = self::getUInt2d($recordData, 4);
|
||||
|
||||
@@ -3214,7 +3214,7 @@ class Xls extends XlsBase
|
||||
$columnString = Coordinate::stringFromColumnIndex($fc + $i + 1);
|
||||
|
||||
// Read cell?
|
||||
if ($this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
if ($this->readFilter->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
$xfIndex = self::getUInt2d($recordData, 4 + 2 * $i);
|
||||
if (isset($this->mapCellXfIndex[$xfIndex])) {
|
||||
$this->phpSheet->getCell($columnString . ($row + 1))->setXfIndex($this->mapCellXfIndex[$xfIndex]);
|
||||
@@ -3252,7 +3252,7 @@ class Xls extends XlsBase
|
||||
$columnString = Coordinate::stringFromColumnIndex($column + 1);
|
||||
|
||||
// Read cell?
|
||||
if ($this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
if ($this->readFilter->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
// offset: 4; size: 2; XF index
|
||||
$xfIndex = self::getUInt2d($recordData, 4);
|
||||
|
||||
@@ -3297,7 +3297,7 @@ class Xls extends XlsBase
|
||||
$columnString = Coordinate::stringFromColumnIndex($col + 1);
|
||||
|
||||
// Read cell?
|
||||
if ($this->getReadFilter()->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
if ($this->readFilter->readCell($columnString, $row + 1, $this->phpSheet->getTitle())) {
|
||||
// offset: 4; size: 2; XF index
|
||||
$xfIndex = self::getUInt2d($recordData, 4);
|
||||
|
||||
@@ -3605,7 +3605,7 @@ class Xls extends XlsBase
|
||||
StringHelper::stringIncrement($rangeBoundaries[1][0]);
|
||||
for ($row = $rangeBoundaries[0][1]; $row <= $rangeBoundaries[1][1]; ++$row) {
|
||||
for ($column = $rangeBoundaries[0][0]; $column != $rangeBoundaries[1][0]; StringHelper::stringIncrement($column)) {
|
||||
if ($this->getReadFilter()->readCell($column, $row, $this->phpSheet->getTitle())) {
|
||||
if ($this->readFilter->readCell($column, $row, $this->phpSheet->getTitle())) {
|
||||
$includeCellRange = true;
|
||||
|
||||
break 2;
|
||||
|
||||
@@ -551,7 +551,7 @@ class LoadSpreadsheet extends Xls
|
||||
/** @var int $row */
|
||||
[$column, $row] = Coordinate::coordinateFromString($cell);
|
||||
/** @var string $baseCell */
|
||||
if ($xls->getReadFilter()->readCell($column, $row, $xls->phpSheet->getTitle())) {
|
||||
if ($xls->readFilter->readCell($column, $row, $xls->phpSheet->getTitle())) {
|
||||
/** @var string */
|
||||
$temp = $xls->sharedFormulas[$baseCell];
|
||||
$formula = $xls->getFormulaFromStructure($temp, $cell);
|
||||
|
||||
@@ -890,7 +890,7 @@ class Xlsx extends BaseReader
|
||||
$sheetViewOptions->load($this->readDataOnly, $this->styleReader);
|
||||
|
||||
(new ColumnAndRowAttributes($docSheet, $xmlSheetNS))
|
||||
->load($this->getReadFilter(), $this->readDataOnly, $this->ignoreRowsWithNoCells);
|
||||
->load($this->readFilter, $this->readDataOnly, $this->ignoreRowsWithNoCells);
|
||||
}
|
||||
|
||||
$holdSelectedCells = $docSheet->getSelectedCells();
|
||||
@@ -1931,7 +1931,7 @@ class Xlsx extends BaseReader
|
||||
// Read cell?
|
||||
$coordinates = Coordinate::coordinateFromString($r);
|
||||
|
||||
if (!$this->getReadFilter()->readCell($coordinates[0], (int) $coordinates[1], $docSheet->getTitle())) {
|
||||
if (!$this->readFilter->readCell($coordinates[0], (int) $coordinates[1], $docSheet->getTitle())) {
|
||||
// Normally, just testing for the f attribute should identify this cell as containing a formula
|
||||
// that we need to read, even though it is outside of the filter range, in case it is a shared formula.
|
||||
// But in some cases, this attribute isn't set; so we need to delve a level deeper and look at
|
||||
|
||||
@@ -432,7 +432,7 @@ class Xml extends BaseReader
|
||||
$arrayRef = AddressHelper::convertFormulaToA1($arrayRange, $rowID, $columnIndex);
|
||||
}
|
||||
|
||||
if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
|
||||
if (!$this->readFilter->readCell($columnID, $rowID, $worksheetName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter;
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Xlsx as XlsxReader;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -49,7 +50,9 @@ class Issue4416Test extends TestCase
|
||||
{
|
||||
$file = self::$file;
|
||||
$reader = new XlsxReader();
|
||||
self::assertInstanceOf(DefaultReadFilter::class, $reader->getReadFilter());
|
||||
$reader->setReadFilter(new Issue4416Filter());
|
||||
self::assertInstanceOf(Issue4416Filter::class, $reader->getReadFilter());
|
||||
$spreadsheet = $reader->load($file);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
self::assertEqualsWithDelta(
|
||||
|
||||
Reference in New Issue
Block a user