Reputation: 3498
I'm just curious why row starts with 1 and column with 0. Is there any special reason or am I missing something important? Why not just both start with 0 or 1 (consistency).
/**
* Set a cell value by using numeric cell coordinates
*
* @param string $pColumn Numeric column coordinate of the cell (A = 0)
* @param string $pRow Numeric row coordinate of the cell
* @param mixed $pValue Value of the cell
* @param bool $returnCell Return the worksheet (false, default) or
the cell (true)
* @return PHPExcel_Worksheet|PHPExcel_Cell
Depending on the last parameter being specified
*/
public function setCellValueByColumnAndRow($pColumn = 0,
$pRow = 1,
$pValue = null,
$returnCell = false)
{
$cell = $this->getCellByColumnAndRow($pColumn, $pRow)->setValue($pValue);
return ($returnCell) ? $cell : $this;
}
Upvotes: 1
Views: 786
Reputation: 212522
The reason is backward compatibility with earlier versions after what was originally a bad decision based on the old PEAR SEW that also had zero-based column IDs
Upvotes: 3