我正在将一个excel文件从我计算机中的文件夹上传到服务器中的文件夹,上传后我正在加载上传的文件以便我可以保护某些单元格,我在下面使用的第一种方法根本不起作用
function LockCertainCells(){
$labref= $this->uri->segment(3);
$objReader = new PHPExcel_Reader_Excel2007();
$path = "analyst_uploads/" . date('Y') . '/' . date('M') . '/'. $labref .'/'. $labref . ".xlsx";
$objPHPExcel = $objReader->load($path);
$objPHPExcel->setActiveSheetIndexbyName('Sample Summary');
$objPHPExcel->getActiveSheet()->protectCells('A17:G85','PHPExcel');
$objPHPExcel ->getActiveSheet()->getProtection()->setSheet(true);
}
这第二个
function LockCertainCells(){
$labref= $this->uri->segment(3);
$objPHPExcel = new PHPExcel;
$path = "analyst_uploads/" . date('Y') . '/' . date('M') . '/'. $labref .'/'. $labref . ".xlsx";
$objSheet = $objPHPExcel->load($path);
$objSheet->setActiveSheetIndexbyName('Sample Summary');
$objSheet->protectCells('A17:G85', 'PHP');
$objSheet->getProtection()->setSheet(true);
}
向我抛出这个错误:
Fatal error: Call to undefined method PHPExcel::load() in C:\127.0.0.1\htdocs\NQCL\.....
建议!