0
美好的一天每个人:D 谢谢大家去看看,非常感谢。PHPExcel返回空白getCalculatedValue
这是一个PHPExcel问题。 我在Excel文件中有A1=-1
,B2=A2=0
,所以B2
应该返回“FALSE”。 但是,当试图通过getCalculatedValue
进行检索时,它将返回空白。
echo $objPHPExcel->getActiveSheet()->getCell('B2')->getCalculatedValue();
对于那些有兴趣,整个代码在这里。
/** 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();
这很好,谢谢:D – Lin