セルからデータを取得するために PHPExcel ライブラリを使用しています。PHPExcel_Reader_IReadFilter
iterfaceを実装し、それをリーダー オブジェクトに設定して、 custom からデータを読み取りrange(B1:J50 e.g)
ました。正常に動作しますが、リーダーは空のセルを取得しませんが、それらを取得する必要があります。を呼び出しますIterateOnlyExistingCells(false)
が、リーダーはフィルターを無視してすべてのセルを取得します。
class CellsFilter implements PHPExcel_Reader_IReadFilter {
private $startCellName;
private $startCellValue;
private $endCellName;
private $endCellValue;
private $additionalCells;
public function __construct($strRange) {
$this->initializeRange($strRange);
}
public function readCell($column, $row, $worksheetName = '') {
if ($row >= $this->startCellValue && $row <= $this->endCellValue) {
if (in_array($column, range($this->startCellName, $this->endCellName))) {
return true;
}
}
return false;
}