SetValue with Formula from another Sheet

Dec 9, 2009 at 5:12 AM

I Write this,

$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setTitle('F7');
$objPHPExcel->createSheet();
$objPHPExcel->setActiveSheetIndex(1);
$objPHPExcel->getActiveSheet()->setTitle('F5');
$objPHPExcel->setActiveSheetIndex(1);
$objPHPExcel->getActiveSheet()->setCellValue('B1','=F7!D10');

But, Excel did not Come Out.

I Use require_once 'PHPExcel/Writer/Excel5.php';

I just want to write formula in Sheet F5 & Cell B1 and value get from F7 & D10

What Should to do ?

 

 

Coordinator
Jan 6, 2010 at 8:31 AM
error_reporting(E_ALL);
set_include_path(get_include_path() . PATH_SEPARATOR . 'Classes/');
/** PHPExcel */
include 'PHPExcel.php';
/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';

$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setTitle('F7');
$objPHPExcel->getActiveSheet()->setCellValue('D10',25);
$objPHPExcel->createSheet();
$objPHPExcel->setActiveSheetIndex(1);
$objPHPExcel->getActiveSheet()->setTitle('F5');
$objPHPExcel->setActiveSheetIndex(1);
$objPHPExcel->getActiveSheet()->setCellValue('B1','=F7!D10');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('createTest.xls');

Works for me