Liuggio\ExcelBundle\Factory::createPHPExcelObject PHP Method

createPHPExcelObject() public method

Creates an empty PHPExcel Object if the filename is empty, otherwise loads the file into the object.
public createPHPExcelObject ( string $filename = null ) : PHPExcel
$filename string
return PHPExcel
    public function createPHPExcelObject($filename = null)
    {
        return null === $filename ? new \PHPExcel() : call_user_func(array($this->phpExcelIO, 'load'), $filename);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 public function createExportObject(Datagrid $datagrid)
 {
     $this->phpExcel = $this->factory->createPHPExcelObject();
     $this->phpExcel->setActiveSheetIndex(0);
     $this->phpExcel->getActiveSheet()->setTitle('Datagrid export');
     // Set the column headers
     $c = 'A';
     foreach ($columns = $datagrid->getColumns() as $column) {
         $this->phpExcel->getActiveSheet()->setCellValue($c . '1', $column->getLabel());
         $c++;
     }
     return $this->phpExcel;
 }
All Usage Examples Of Liuggio\ExcelBundle\Factory::createPHPExcelObject