Issue when setting cell value.

Topics: User Forum
Mar 12, 2015 at 5:30 PM
Hey guys... I'll cut to the chase, here's my code:
$row->Amount = $row->Amount + 100;
echo 'The amount is '.$row->Amount.' and will be stored at A'.$row->SpreadsheetRow.'<br>';
$as->setCellValueExplicit('A'.$row->SpreadsheetRow, $row->Amount );
echo 'The amount stored is: '.$as->getCell('A'.$row->SpreadsheetRow)->getValue().'<br>';

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $inputFileType);
Pretty straightforward, uh?
The output for the echos come like this:

The amount is 235 and will be stored at A5
The amount stored is: 235
The amount is 213 and will be stored at A6
The amount stored is: 213

Which is, exactly what I expected.

Now, A5, A6, and every cell comes with a value of 100, completely ignoring $row->Amount's value at all. tried everything here, cast as int, float, change var name, no luck. It always ignores the value of that var that comes from a sql query.

Any ideas at all?