I am using this Cake helper https://github.com/segy/PhpExcel, now I have a lot problem as this:
Method PhpExcelHelper::createWorksheet does not exist [CORE\Cake\View\Helper.php, line 192] Method PhpExcelHelper::addTableHeader does not exist [CORE\Cake\View\Helper.php, line 192] Method PhpExcelHelper::addTableRow does not exist [CORE\Cake\View\Helper.php, line 192] Method PhpExcelHelper::addTableRow does not exist [CORE\Cake\View\Helper.php, line 192] Method PhpExcelHelper::addTableRow does not exist [CORE\Cake\View\Helper.php, line 192] Method PhpExcelHelper::addTableFooter does not exist [CORE\Cake\View\Helper.php, line 192] Missing argument 1 for Helper::output(), called in C:\Program Files\PostgreSQL\EnterpriseDB-ApachePHP\apache\www\prueba\app\View\Documentos\index.ctp on line 33 and defined [CORE\Cake\View\Helper.php, line 806] Undefined variable: str [CORE\Cake\View\Helper.php, line 807] Method PhpExcelHelper::exit does not exist [CORE\Cake\View\Helper.php, line 192] Model Documento.php
<?php
class Documento extends AppModel {
public $useTable = 'documento';
}
?>
Controller DocumentosController.php
<?php
class DocumentosController extends AppController {
public $helpers = array('Html', 'Form','PhpExcel.PhpExcel');
public function index() {
$this->set('documentos', $this->Documento->find('all'));
}
}
?>
This is my view index.ctp
<?php
$this->PhpExcel->createWorksheet();
// define table cells
$table = array(
array('label' => __('Nombre'), 'filter' => true),
array('label' => __('Apellido'), 'filter' => true),
array('label' => __('Edad individuo')),
array('label' => __('Domicilio'), 'width' => 50, 'wrap' => true),
array('label' => __('Fecha'))
);
// add heading with different font and bold text
$this->PhpExcel->addTableHeader($table, array('name' => 'Cambria', 'bold' => true));
// add data
foreach ($documentos as $documento) {
$this->PhpExcel->addTableRow(array(
$documento['Documento']['nombre'],
$documento['Documento']['apellido'],
$documento['Documento']['edad'],
$documento['Documento']['domicilio'],
$documento['Documento']['fecha']
));
}
// close table and output
$this->PhpExcel->addTableFooter()
->output();
?>