problem of variables of setCellValueExplicitByColumnAndRow

Topics: Developer Forum
Jan 6, 2011 at 11:52 AM

I noticed that in function : setCellValueExplicitByColumnAndRow(column,row,value), column starts at 0 but row starts at 1. Here is the code of the function
public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 0, $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING)
        return $this->getCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow)->setValueExplicit($pValue, $pDataType);

I would suggest this :

return $this->getCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow+1)->setValueExplicit($pValue, $pDataType);


There is the same issue on getcellbycolumn and FromArray

is it normal?

Thank you in advance,

Jan 6, 2011 at 12:47 PM

This is a historical bug and will not be fixed: fixing i would mean that *every* script written using PHPExcel has to be modified. Since this is breaking behaviour, it will not be fixed.

An easy method to remember: If you look at a worksheet in Excel / OOCalc, column names start at A (=0) and rows start at 1.

Jan 6, 2011 at 12:59 PM

Ok I understand..:)

Thank you for your feedback.