/** {@inheritdoc} */ public function create($path, array $firstRow, $sheetName = '') { $workbook = new Workbook(); $sheet = new Sheet($workbook); $table = new Table(); $table->setRow($firstRow); $sheet->addTable($table, new Coordinate(1, 1)); $workbook->addSheet($sheet); $writerFactory = new WriterFactory(); $writer = $writerFactory->createWriter(new Excel5($path)); $phpExcel = $writer->convert($workbook); $writer->write($phpExcel); }
/** * @param WorkbookInterface $workbook The parent Workbook where the Sheet will live * @param PHPExcel_Worksheet $phpExcelWorksheet */ public function __construct(Workbook $workbook, PHPExcel_Worksheet $phpExcelWorksheet = null) { $this->phpExcelWorksheet = $phpExcelWorksheet ?: new PHPExcel_Worksheet($workbook->getRawClass()); }