我正在尝试使用 phpexcel 将数据导出到 excel,但它返回此错误,但指定的 excel 文件在该位置突出显示。问题是excel文件在那个位置,但是一旦它返回那个错误,文件就找不到了,我做错了什么?
错误:
致命错误:C:\server\htdocs\NQCL\application\third_party\PHPExcel 中的消息“文件 zip://workbooks/NDQA201303001/NDQA201303001.xlsx#xl/media/nqcl1.png 不存在”未捕获的异常“异常” \Writer\Excel2007\ContentTypes.php:216
处理进程的网页脚本代码
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("workbooks/" . $labref . "/" . $labref . ".xlsx");
$objPHPExcel->getActiveSheet(0)
->setCellValue('E22', 'Tabs/Capsule Weight')
->setCellValue('E23', 'No.')
->setCellValue('F23', 'Tabs/Capsule Weights (mg)');
$dir = "workbooks";
if (is_dir($dir)) {
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save("workbooks/" . $labref . "/" . $labref . ".xlsx");
echo 'Data exported';
} else {
echo 'Dir does not exist';
}