12345678910111213141516171819202122232425262728293031 |
- <?php
- namespace app\models;
- use PhpOffice\PhpSpreadsheet\IOFactory;
- use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
- class ExcelFilter implements IReadFilter
- {
- private $startRow = 0;
- private $endRow = 0;
- private $columns = [];
- public function __construct($startRow, $endRow, $columns)
- {
- $this->startRow = $startRow;
- $this->endRow = $endRow;
- $this->columns = $columns;
- }
- public function readCell($column, $row, $worksheetName = '')
- {
- if ($row >= $this->startRow) {
- if (in_array($column, $this->columns)) {
- return true;
- }
- }
- return false;
- }
- }
|