EllisLab text mark
Advanced Search
     
Error when loading PHPExcel/Worksheet
Posted: 19 November 2012 08:54 AM   [ Ignore ]
Joined: 2010-12-18
2 posts

Hi,
Would you tell me what’s wrong in this code please

$this->load->library('PHPExcel');
$this->load->library('PHPExcel/IOFactory');

$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->setTitle("Feuil 1");
$objPHPExcel->setActiveSheetIndex(0)
 ->
setCellValueByColumnAndRow(12"I'm a test")
 ->
mergeCellsByColumnAndRow(1252)
 ->
getColumnDimension(5)->setAutoSize(true);

$this->load->library('PHPExcel/Worksheet');
$this->load->library('PHPExcel/Worksheet/BaseDrawing');
$this->load->library('PHPExcel/Worksheet/Drawing');

$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName("logo");
$objDrawing->setDescription("Tt's my logo");
$objDrawing->setPath("/images/logo.png");
$objDrawing->setCoordinates('B2');
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$objPHPExcel->getActiveSheet()->getStyle('B2')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objPHPExcel->getActiveSheet()->getStyle('B2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);

// Save it as an excel 2003 file
$objWriter IOFactory::createWriter($objPHPExcel"Excel5");
$objWriter->save("system/docs/test.xls"); 

I Have the folowing error “Fatal error: Call to a member function getSheetByName() on a non-object in /system/libraries/PHPExcel/Worksheet.php on line 657

 
Posted: 21 November 2012 12:39 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2010-07-19
324 posts

Try this example here http://www.ahowto.net/php/easily-integrateload-phpexcel-into-codeigniter-framework

 Signature 

I ask a lot of questions…..........................