1234567891011121314151617181920212223242526 |
- <?php
- namespace cutExcel;
- /**
- * 预读过滤类
- * @author wangyelou
- * @date 2018-07-30
- */
- class MyAheadreadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter
- {
- public $record = array();
- private $lastRow = '';
- public function readCell($column, $row, $worksheetName = '')
- {
- if (isset($this->record[$worksheetName]) ) {
- if ($this->lastRow != $row) {
- $this->record[$worksheetName] ++;
- $this->lastRow = $row;
- }
- } else {
- $this->record[$worksheetName] = 1;
- $this->lastRow = $row;
- }
- return false;
- }
- }
|