Reputation: 123
Good day everyone :D Thank you all for taking a look, much obliged.
This is a PHPExcel Question.
I have in the Excel file, A1=-1
, B2=A2=0
, so B2
should return "FALSE".
However, when trying to retrive it through getCalculatedValue
, it returns blank.
echo $objPHPExcel->getActiveSheet()->getCell('B2')->getCalculatedValue();
For those interested, the whole code is here.
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . '../Classes/');
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';
/** Load Excel File **/
$inputFileName = './TrueFalse.xlsx';
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
/** Change A2 Value **/
$objPHPExcel->getActiveSheet()->setCellValue('A2','=-1');
/** Calculate and State B2 Value **/
echo '<br><br> Show Calculated Value for B2';
echo '<br> B2 = ';
echo $objPHPExcel->getActiveSheet()->getCell('B2')->getCalculatedValue();
Upvotes: 0
Views: 1198
Reputation: 212452
a PHP echo statement will display nothing for a FALSE value. Either use
var_dump($objPHPExcel->getActiveSheet()->getCell('B2')->getCalculatedValue());
though var_dump should normally only be used for debugging; or something like:
echo $objPHPExcel->getActiveSheet()->getCell('B2')->getCalculatedValue() ? 'TRUE' : 'FALSE';
Upvotes: 1