我尝试获得excel文件并将其覆盖到pdf。我更迭,但我没有看到这些数据,并告诉我不能将数据加载到PDFphpExcel in codeigniter
这里我的代码:
//load our new PHPExcel library
$this->load->library('excel');
$inputFileName = 'nameoffile';
$excel2 = PHPExcel_IOFactory::createReader('Excel5');
$excel2 = $excel2->load($inputFileName.'.xls');
$excel2->setActiveSheetIndex(0);
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Content-Type: application/force-download');
header('Content-Type: application/octet-stream');
header('Content-Type: application/download');
header("Content-Disposition: attachment;filename=from-template.pdf");
header('Content-Transfer-Encoding: binary');
$objWriter = PHPExcel_IOFactory::createWriter($excel2, 'pdf');
$objWriter->save('php://output');
什么是您收到的实际错误消息? – 2014-10-10 18:23:41
致命错误:未找到'PHPExcel_Writer_xls'类 – idan003 2014-10-10 19:25:39
您发布的代码应该会生成该错误;你正在尝试创建一个'pdf' Writer,而不是'xls' Writer – 2014-10-10 20:02:22