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
示例#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;
 }
示例#2
0
 public function testCreate()
 {
     $factory = new Factory();
     $this->assertInstanceOf('\\PHPExcel', $factory->createPHPExcelObject());
 }