Persisting a spreadsheet on the Session

Topics: Developer Forum
Nov 6, 2009 at 10:30 AM
Edited Nov 6, 2009 at 10:36 AM

Trying to persist a spreadsheet on the Session:-

 

session_start();

$objPHPExcel = new PHPExcel();

if (!isset($_SESSION['objPHPExcel'])) {
	$objPHPExcel = PHPExcel_IOFactory::load("myfile.xlsx");
} else {
	$objPHPExcel = (Object) $_SESSION['objPHPExcel'];
}

$_SESSION['objPHPExcel'] = $objPHPExcel;

session_commit();

 

This works like a treat when reading from the file but when POST-ing back and attempting to update the value in a cell:-

 

$objPHPExcel->getActiveSheet()->setCellValue('F6', '100');

 

The following error is seen:-

Fatal error: Call to a member function bindValue() on a non-object in ...\Classes\PHPExcel\Cell.php on line 217

Am I missing something?

TIA


Versions: PHP 5.2.11 & PHPExcel 1.7.1

Developer
Nov 7, 2009 at 1:05 AM

Work item created:

http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=10894

Download latest source code from here tomorrow:

http://phpexcel.codeplex.com/SourceControl/ListDownloadableCommits.aspx

Nov 9, 2009 at 9:16 AM

Thanks for the reply. As a workaround I found this to work:

$objPHPExcel->getActiveSheet()->setCellValueExplicit('F6', $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);