/**
* Untuk menghasilkan data excel
*
* @access public
* @return Excel_generator
*/
public function generate()
{
$start = $this->start;
if (count($this->header) > 0) {
$abj = 1;
foreach ($this->header as $row) {
$this->getActiveSheet()->setCellValue($this->columnName($abj) . $this->start, $row);
if ($this->header_bold) {
$this->getActiveSheet()->getStyle($this->columnName($abj) . $this->start)->getFont()->setBold(TRUE);
}
$abj++;
}
$start = $this->start + 1;
}
foreach ($this->query->result_array() as $result_db) {
$index = 1;
foreach ($this->column as $row) {
if (count($this->width) > 0) {
$this->getActiveSheet()->getColumnDimension($this->columnName($index))->setWidth($this->width[$index - 1]);
}
$this->getActiveSheet()->setCellValue($this->columnName($index) . $start, $result_db[$row]);
$index++;
}
$start++;
}
return $this;
}