以非统一格式使用 PHPExcel 库获取Excel, 参考图像
我的代码是:
$this->load->library('excel');
$sheet = new PHPExcel();
$objWorkSheet = $sheet->createSheet();
$sheet->getProperties()->setTitle('Report')->setDescription('Report');
$sheet->setActiveSheetIndex(0);
$sheet->getActiveSheet()->setCellValue('A1','Career Stage');
$sheet_writer = PHPExcel_IOFactory::createWriter($sheet, 'Excel5');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="pathways_'.date('dMy').'.xls"');
header('Cache-Control: max-age=0');
$sheet_writer->save('php://output');