Welcome Guest, Not a member yet? Register   Sign In
Error when loading PHPExcel/Worksheet
#1

[eluser]Unknown[/eluser]
Hi,
Would you tell me what's wrong in this code please
Code:
$this->load->library('PHPExcel');
$this->load->library('PHPExcel/IOFactory');

$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->setTitle("Feuil 1");
$objPHPExcel->setActiveSheetIndex(0)
->setCellValueByColumnAndRow(1, 2, "I'm a test")
->mergeCellsByColumnAndRow(1, 2, 5, 2)
->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"
#2

[eluser]Otemu[/eluser]
Try this example here http://www.ahowto.net/php/easily-integra...-framework




Theme © iAndrew 2016 - Forum software by © MyBB